[ 
https://issues.apache.org/jira/browse/HTTPASYNC-131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16295311#comment-16295311
 ] 

ccin commented on HTTPASYNC-131:
--------------------------------

"socket timeout " is the timeout for waiting for data。 this time is after i get 
a connection 
from the connection manager。is that right?
otherwise,is there any way to config socket / connect timeouts less than 1000ms 
in httpasyncclient?

> 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