use of org.asynchttpclient.RequestBuilder 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.RequestBuilder 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.RequestBuilder in project async-http-client by AsyncHttpClient.
the class HttpsProxyTest method testRequestProxy.
@Test(groups = "standalone")
public void testRequestProxy() throws Exception {
try (AsyncHttpClient asyncHttpClient = asyncHttpClient(config().setFollowRedirect(true).setUseInsecureTrustManager(true))) {
RequestBuilder rb = get(getTargetUrl2()).setProxyServer(proxyServer("localhost", port1));
Response r = asyncHttpClient.executeRequest(rb.build()).get();
assertEquals(r.getStatusCode(), 200);
}
}
use of org.asynchttpclient.RequestBuilder in project async-http-client by AsyncHttpClient.
the class HttpsProxyTest method testPooledConnectionsWithProxy.
@Test(groups = "standalone")
public void testPooledConnectionsWithProxy() throws Exception {
try (AsyncHttpClient asyncHttpClient = asyncHttpClient(config().setFollowRedirect(true).setUseInsecureTrustManager(true).setKeepAlive(true))) {
RequestBuilder rb = get(getTargetUrl2()).setProxyServer(proxyServer("localhost", port1));
Response r1 = asyncHttpClient.executeRequest(rb.build()).get();
assertEquals(r1.getStatusCode(), 200);
Response r2 = asyncHttpClient.executeRequest(rb.build()).get();
assertEquals(r2.getStatusCode(), 200);
}
}
use of org.asynchttpclient.RequestBuilder in project async-http-client by AsyncHttpClient.
the class SimpleAsyncHttpClient method options.
public Future<Response> options(BodyConsumer bodyConsumer) throws IOException {
RequestBuilder r = rebuildRequest(requestBuilder.build());
r.setMethod("OPTIONS");
return execute(r, bodyConsumer, null);
}
Aggregations