@Test(groups = "online") public void asyncStatusHEADContentLenghtTest() throws Exception { try (AsyncHttpClient p = asyncHttpClient(config().setFollowRedirect(true))) { final CountDownLatch l = new CountDownLatch(1); p.executeRequest( head("http://www.google.com/"), new AsyncCompletionHandlerAdapter() { @Override public Response onCompleted(Response response) throws Exception { try { assertEquals(response.getStatusCode(), 200); return response; } finally { l.countDown(); } } }) .get(); if (!l.await(5, TimeUnit.SECONDS)) { fail("Timeout out"); } } }
@Test(groups = "online") public void evilCoookieTest() throws Exception { try (AsyncHttpClient c = asyncHttpClient()) { RequestBuilder builder = get("http://localhost") // .setFollowRedirect(true) // .setUrl("http://www.google.com/") // .addHeader("Content-Type", "text/plain") // .addCookie( new Cookie( "evilcookie", "test", false, ".google.com", "/", Long.MIN_VALUE, false, false)); Response response = c.executeRequest(builder.build()).get(); assertNotNull(response); assertEquals(response.getStatusCode(), 200); } }