Establish connect timeout to remote server is not work with HttpComponents5MessageSender
phuc98ute opened this issue · 0 comments
Hi team,
I am trying to use a new class HttpComponents5MessageSender instead old class HttpComponentsMessageSender this have the same 2 functions: setConnectionTimeout and setReadTimeout
I debugged in the logic code and found that the connection timeout from new class HttpComponents5MessageSender will passed to HttpComponents5ClientFactory. And based on the HttpComponents5ClientFactory doc page, the function setConnectionTimeout should be "Sets the timeout until a connection is established."
However, when dig dive into the logic code, I found that the first logic implement for HttpComponents5ClientFactory is implement as expected when set the connectTimeout for RequestConfig at here, at this issue.
But on the version v4.0.5, and at this commit, the function setConnectTimeout is replaced by setConnectionRequestTimeout.
However, the 2 function are not the same:
- setConnectionRequestTimeout: the connection lease request timeout used when requesting a connection from the connection manager.
- setConnectTimeout: Determines the timeout until a new connection is fully established. This may also include transport security negotiation exchanges such as SSL or TLS protocol negotiation).
The result is the connect timeout is not working as expected when migrating from HttpComponentsMessageSender to HttpComponents5MessageSender and keeping both functions setConnectionTimeout, setReadTimeout. And the connect timeout will default to 2 minutes despite a specific configuration for HttpComponents5MessageSender.setConnectionTimeout