ok2c commented on issue #151: TLS session and HTTP/1.1 data buffering improvements URL: https://github.com/apache/httpcomponents-core/pull/151#issuecomment-535212646 @rschmitt That is one of doing it. One needs to pass `HttpContext` as a parameter to the `#execute` method. ``` final CountDownLatch latch1 = new CountDownLatch(1); final SimpleHttpRequest request2 = SimpleHttpRequests.GET.create("http://httpbin.org/get"); final HttpClientContext clientContext = HttpClientContext.create(); clientContext.setRequestConfig(RequestConfig.custom() .setResponseTimeout(Timeout.ofSeconds(5)) .build()); httpclient.execute(request2, clientContext, new FutureCallback<SimpleHttpResponse>() { @Override public void completed(final SimpleHttpResponse response2) { latch1.countDown(); System.out.println(request2.getRequestUri() + "->" + response2.getCode()); } @Override public void failed(final Exception ex) { latch1.countDown(); System.out.println(request2.getRequestUri() + "->" + ex); } @Override public void cancelled() { latch1.countDown(); System.out.println(request2.getRequestUri() + " cancelled"); } }); latch1.await(); ```
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
