use of org.asynchttpclient.Request in project async-http-client by AsyncHttpClient.
the class TimeToLiveIssue method testTTLBug.
@Test(enabled = false, description = "https://github.com/AsyncHttpClient/async-http-client/issues/1113")
public void testTTLBug() throws Throwable {
try (AsyncHttpClient client = asyncHttpClient(config().setKeepAlive(true).setConnectionTtl(1).setPooledConnectionIdleTimeout(1))) {
for (int i = 0; i < 200000; ++i) {
Request request = new RequestBuilder().setUrl(String.format("http://localhost:%d/", port1)).build();
Future<Response> future = client.executeRequest(request);
future.get(5, TimeUnit.SECONDS);
// from sometimes winning over poll for the ownership of a connection.
if (System.currentTimeMillis() % 100 == 0) {
Thread.sleep(5);
}
}
}
}
use of org.asynchttpclient.Request in project async-http-client by AsyncHttpClient.
the class WebDavBasicTest method mkcolWebDavTest2.
@Test(groups = "standalone")
public void mkcolWebDavTest2() throws InterruptedException, IOException, ExecutionException {
try (AsyncHttpClient c = asyncHttpClient()) {
Request mkcolRequest = new RequestBuilder("MKCOL").setUrl(getTargetUrl() + "/folder2").build();
Response response = c.executeRequest(mkcolRequest).get();
assertEquals(response.getStatusCode(), 409);
}
}
use of org.asynchttpclient.Request in project async-http-client by AsyncHttpClient.
the class WebDavBasicTest method basicPropFindWebDavTest.
@Test(groups = "standalone")
public void basicPropFindWebDavTest() throws InterruptedException, IOException, ExecutionException {
try (AsyncHttpClient c = asyncHttpClient()) {
Request propFindRequest = new RequestBuilder("PROPFIND").setUrl(getTargetUrl()).build();
Response response = c.executeRequest(propFindRequest).get();
assertEquals(response.getStatusCode(), 404);
}
}
use of org.asynchttpclient.Request in project async-http-client by AsyncHttpClient.
the class WebDavBasicTest method mkcolWebDavTest1.
@Test(groups = "standalone")
public void mkcolWebDavTest1() throws InterruptedException, IOException, ExecutionException {
try (AsyncHttpClient c = asyncHttpClient()) {
Request mkcolRequest = new RequestBuilder("MKCOL").setUrl(getTargetUrl()).build();
Response response = c.executeRequest(mkcolRequest).get();
assertEquals(response.getStatusCode(), 201);
}
}
use of org.asynchttpclient.Request in project async-http-client by AsyncHttpClient.
the class ResumableAsyncHandlerTest method testAdjustRange.
@Test
public void testAdjustRange() {
MapResumableProcessor proc = new MapResumableProcessor();
ResumableAsyncHandler handler = new ResumableAsyncHandler(proc);
Request request = get("http://test/url").build();
Request newRequest = handler.adjustRequestRange(request);
assertEquals(newRequest.getUri(), request.getUri());
String rangeHeader = newRequest.getHeaders().get(RANGE);
assertNull(rangeHeader);
proc.put("http://test/url", 5000);
newRequest = handler.adjustRequestRange(request);
assertEquals(newRequest.getUri(), request.getUri());
rangeHeader = newRequest.getHeaders().get(RANGE);
assertEquals(rangeHeader, "bytes=5000-");
}
Aggregations