Search in sources :

Example 11 with RequestBuilder

use of org.asynchttpclient.RequestBuilder in project async-http-client by AsyncHttpClient.

the class SimpleAsyncHttpClient method delete.

public Future<Response> delete(ThrowableHandler throwableHandler) throws IOException {
    RequestBuilder r = rebuildRequest(requestBuilder.build());
    r.setMethod("DELETE");
    return execute(r, null, throwableHandler);
}
Also used : RequestBuilder(org.asynchttpclient.RequestBuilder)

Example 12 with RequestBuilder

use of org.asynchttpclient.RequestBuilder in project async-http-client by AsyncHttpClient.

the class SimpleAsyncHttpClient method delete.

public Future<Response> delete(BodyConsumer bodyConsumer) throws IOException {
    RequestBuilder r = rebuildRequest(requestBuilder.build());
    r.setMethod("DELETE");
    return execute(r, bodyConsumer, null);
}
Also used : RequestBuilder(org.asynchttpclient.RequestBuilder)

Example 13 with RequestBuilder

use of org.asynchttpclient.RequestBuilder in project async-http-client by AsyncHttpClient.

the class SimpleAsyncHttpClient method post.

public Future<Response> post(BodyGenerator bodyGenerator, ThrowableHandler throwableHandler) throws IOException {
    RequestBuilder r = rebuildRequest(requestBuilder.build());
    r.setMethod("POST");
    r.setBody(bodyGenerator);
    return execute(r, null, throwableHandler);
}
Also used : RequestBuilder(org.asynchttpclient.RequestBuilder)

Example 14 with RequestBuilder

use of org.asynchttpclient.RequestBuilder in project async-http-client by AsyncHttpClient.

the class SimpleAsyncHttpClient method options.

public Future<Response> options(ThrowableHandler throwableHandler) throws IOException {
    RequestBuilder r = rebuildRequest(requestBuilder.build());
    r.setMethod("OPTIONS");
    return execute(r, null, throwableHandler);
}
Also used : RequestBuilder(org.asynchttpclient.RequestBuilder)

Example 15 with RequestBuilder

use of org.asynchttpclient.RequestBuilder in project async-http-client by AsyncHttpClient.

the class ConnectionPoolTest method nonPoolableConnectionReleaseSemaphoresTest.

@Test(groups = "standalone")
public void nonPoolableConnectionReleaseSemaphoresTest() throws Throwable {
    RequestBuilder request = get(getTargetUrl()).setHeader("Connection", "close");
    try (AsyncHttpClient client = asyncHttpClient(config().setMaxConnections(6).setMaxConnectionsPerHost(3))) {
        client.executeRequest(request).get();
        Thread.sleep(1000);
        client.executeRequest(request).get();
        Thread.sleep(1000);
        client.executeRequest(request).get();
        Thread.sleep(1000);
        client.executeRequest(request).get();
    }
}
Also used : RequestBuilder(org.asynchttpclient.RequestBuilder) AsyncHttpClient(org.asynchttpclient.AsyncHttpClient) Test(org.testng.annotations.Test) AbstractBasicTest(org.asynchttpclient.AbstractBasicTest)

Aggregations

RequestBuilder (org.asynchttpclient.RequestBuilder)44 Request (org.asynchttpclient.Request)18 AsyncHttpClient (org.asynchttpclient.AsyncHttpClient)17 Test (org.testng.annotations.Test)17 Response (org.asynchttpclient.Response)14 AbstractBasicTest (org.asynchttpclient.AbstractBasicTest)9 Realm (org.asynchttpclient.Realm)4 SpnegoEngineException (org.asynchttpclient.spnego.SpnegoEngineException)4 HttpHeaders (io.netty.handler.codec.http.HttpHeaders)3 Uri (org.asynchttpclient.uri.Uri)3 DefaultHttpHeaders (io.netty.handler.codec.http.DefaultHttpHeaders)2 HttpRequest (io.netty.handler.codec.http.HttpRequest)2 UUID (java.util.UUID)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 Consumer (java.util.function.Consumer)2 Slf4j (lombok.extern.slf4j.Slf4j)2 lombok.val (lombok.val)2 Request (okhttp3.Request)2 Response (okhttp3.Response)2 REQUEST (org.asynchttpclient.extras.retrofit.AsyncHttpClientCallTest.REQUEST)2