[ 
https://issues.apache.org/jira/browse/HTTPASYNC-131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Oleg Kalnichevski resolved HTTPASYNC-131.
-----------------------------------------
    Resolution: Invalid

You code is not wrong, your expectations are. Please see the definition of 
socket timeout

Please also note that by default the granularity of socket / connect timeouts 
of non-blocking I/O reactors is 1000 ms.

Oleg 

> SocketTimeout doesn't work for me
> ---------------------------------
>
>                 Key: HTTPASYNC-131
>                 URL: https://issues.apache.org/jira/browse/HTTPASYNC-131
>             Project: HttpComponents HttpAsyncClient
>          Issue Type: Bug
>    Affects Versions: 4.1.3
>         Environment: httpasyncclient-4.1.3.jar
> httpcore-4.4.7.jar
> httpcore-nio-4.4.7.jar
>            Reporter: ccin
>            Priority: Critical
>
> my code is like this,but the timeout config doesn't work for me,i still get a 
> response more than 100ms which i expect a timeout exception.Is there 
> something wrong with my code?ths for your help
> {code:java}
>         RequestConfig requestConfig = RequestConfig.custom()
>                 .setConnectTimeout(50)
>                 .setSocketTimeout(50)
>                 
> .setConnectionRequestTimeout(config.getConnectTimeout()).build();
>         Registry<SchemeIOSessionStrategy> sessionStrategyRegistry = 
> RegistryBuilder
>                 .<SchemeIOSessionStrategy>create()
>                 .register("http", NoopIOSessionStrategy.INSTANCE)
>                 .build();
>         IOReactorConfig ioReactorConfig = IOReactorConfig.custom()
>                 .setIoThreadCount(Runtime.getRuntime().availableProcessors())
>                 .setSoTimeout(50)
>                 .setConnectTimeout(50)
>                 .build();
>         ConnectingIOReactor ioReactor = new 
> DefaultConnectingIOReactor(ioReactorConfig);
>         PoolingNHttpClientConnectionManager conMgr = new 
> PoolingNHttpClientConnectionManager(
>                 ioReactor, null, sessionStrategyRegistry, null);
>         conMgr.setMaxTotal(config.getPoolSize());
>         conMgr.setDefaultMaxPerRoute(config.getMaxPerRoute());
>         ConnectionConfig connectionConfig = ConnectionConfig.custom()
>                 .setMalformedInputAction(CodingErrorAction.IGNORE)
>                 .setUnmappableInputAction(CodingErrorAction.IGNORE)
>                 .setCharset(Consts.UTF_8).build();
>         conMgr.setDefaultConnectionConfig(connectionConfig);
>         CloseableHttpAsyncClient client = 
> HttpAsyncClients.custom().setConnectionManager(conMgr)
>                 .setDefaultCookieStore(new BasicCookieStore())
>                 .setDefaultRequestConfig(requestConfig).build();
>         client.start();
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to