use of io.netty.handler.codec.http.cookie.DefaultCookie in project async-http-client by AsyncHttpClient.
the class BasicHttpTest method getWithCookies.
@Test
public void getWithCookies() throws Throwable {
withClient().run(client -> {
withServer(server).run(server -> {
final Cookie coo = new DefaultCookie("foo", "value");
coo.setDomain("/");
coo.setPath("/");
server.enqueueEcho();
client.prepareGet(getTargetUrl()).addCookie(coo).execute(new AsyncCompletionHandlerAdapter() {
@Override
public Response onCompleted(Response response) throws Exception {
assertEquals(response.getStatusCode(), 200);
List<Cookie> cookies = response.getCookies();
assertEquals(cookies.size(), 1);
assertEquals(cookies.get(0).toString(), "foo=value");
return response;
}
}).get(TIMEOUT, SECONDS);
});
});
}
Aggregations