On Mon, 2014-08-25 at 20:13 +0800, whybert wrote:
> Thank you for your reply.
> 
> 
> I think I just set the IOReactorConfig.setConnectTimeout(). This is my code 
> (HttpAsyncClient4.0.2) :
> 
> 
> public class Test {
>     public static void main(String[] args) throws InterruptedException,
>             IOException, TimeoutException {
>         IOReactorConfig ioReactorConfig = IOReactorConfig.custom()
>                 .setConnectTimeout(2000).build();
>         ConnectingIOReactor ioReactor = new DefaultConnectingIOReactor(
>                 ioReactorConfig);
>         PoolingNHttpClientConnectionManager cm = new 
> PoolingNHttpClientConnectionManager(
>                 ioReactor);
>         CloseableHttpAsyncClient httpclient = HttpAsyncClients.custom()
>                 .setConnectionManager(cm).build();
>         httpclient.start();
>         HttpGet request = new HttpGet("http://1.1.1.1/";);
>         Future<HttpResponse> future = httpclient.execute(request, null);
>         long timeSt = new Date().getTime();
>         try {
>             HttpResponse response = future.get();
>         } catch (InterruptedException e) {
>             e.printStackTrace();
>         } catch (ExecutionException e) {
>             System.out.println(new Date().getTime() - timeSt);
>             System.out.println(e.getMessage());
>         }
>         httpclient.close();
>     }
> }
> 
> 
> It took 21 seconds to get a ConnectException while the ConnectTimeout was 2 
> seconds. 
> Could you help me to look at this problem? Thanks!
> 

Whybert

Please post a wire / context log of the session.

http://hc.apache.org/httpcomponents-client-4.3.x/logging.html

Oleg



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to