use of org.asynchttpclient.channel.KeepAliveStrategy in project async-http-client by AsyncHttpClient.
the class BasicHttpsTest method multipleConcurrentPostRequestsOverHttpsWithDisabledKeepAliveStrategy.
@Test
public void multipleConcurrentPostRequestsOverHttpsWithDisabledKeepAliveStrategy() throws Throwable {
logger.debug(">>> multipleConcurrentPostRequestsOverHttpsWithDisabledKeepAliveStrategy");
KeepAliveStrategy keepAliveStrategy = (ahcRequest, nettyRequest, nettyResponse) -> !ahcRequest.getUri().isSecured();
withClient(config().setSslEngineFactory(createSslEngineFactory()).setKeepAliveStrategy(keepAliveStrategy)).run(client -> withServer(server).run(server -> {
server.enqueueEcho();
server.enqueueEcho();
server.enqueueEcho();
String body = "hello there";
client.preparePost(getTargetUrl()).setBody(body).setHeader(CONTENT_TYPE, "text/html").execute();
client.preparePost(getTargetUrl()).setBody(body).setHeader(CONTENT_TYPE, "text/html").execute();
Response response = client.preparePost(getTargetUrl()).setBody(body).setHeader(CONTENT_TYPE, "text/html").execute().get();
assertEquals(response.getResponseBody(), body);
}));
logger.debug("<<< multipleConcurrentPostRequestsOverHttpsWithDisabledKeepAliveStrategy");
}
Aggregations