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

Sergey B. commented on HTTPCLIENT-1362:
---------------------------------------

I suppose It would be the best decision to re-use original message.

It seems that there are two independent timeouts: one in Java socket 
implementation and one in OS level. When Java timeout expires, 'connect' method 
throws SocketTimeoutException, but when OS timeout expires, we get 
ConnectException.

Here is output from my test:

java.net.SocketTimeoutException: connect timed out
Timeout specified: 20 sec; time elapsed: 20 sec

java.net.ConnectException: Connection timed out: connect
Timeout specified: 30 sec; time elapsed: 21 sec

                
> Confusing message in HttpHostConnectException
> ---------------------------------------------
>
>                 Key: HTTPCLIENT-1362
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1362
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>            Reporter: Sergey B.
>            Priority: Trivial
>              Labels: exception
>
> TCP connection can fail with two different kind of errors: 'Connection timed' 
> out and 'Connection refused'. When a connection error occurs HttpClient 
> catches SocketException and replaces it with HttpHostConnectException. In 
> addition to exception class it replaces exception message, changing original 
> text with 'Connection to ... refused'. This message is confusing because it 
> looks very much like SocketException 'Connection refused', but in fact it 
> hides original 'Connection timed out'.
> Consider using different messages in HttpHostConnectException depending on 
> parent exception.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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

Reply via email to