Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-1940

org.apache.http.conn.ssl.SSLSocketFactory no longer throws ConnectTimeoutException


    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.5.3
    • Fix Version/s: 4.5.7
    • Component/s: HttpClient (classic)
    • Labels:


      We are upgrading httpclient from 4.2.3 to 4.5.3. We wanted to do the upgrade in steps: first we just bump the versions and then we gradually refactor the existing code to use the new builder-based api.

      It turns out that there is a behavior change in "org.apache.http.conn.ssl.SSLSocketFactory" (which is deprecated in 4.3+): in case of a connect timeout, it does not translate the exception to ConnectTimeoutException. This is inconsistent with the also deprecated "org.apache.http.conn.scheme.PlainSocketFactory". In the 4.2.x series, the exception used to be converted. These are likely the commits that introduced the issue:


      I attached a test that reproduces the bug: ConnectExceptionTest.java

      This bug is not reproducible with the new builder api. However, given that the old api was kept to maintain backwards compatibility, I think it is reasonable to expect the old behavior.

      As workarounds to this issue, one can either update the code and use the new api or catch the java.net.SocketTimeoutException and check if the message is "connect timed out".

      Given that the bug hides in deprecated code and there are workarounds, maybe it is not worth fixing it. In that case, please feel free to close this ticket. Otherwise, I can submit a patch.




            • Assignee:
              marcelocenerine Marcelo Cenerino
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: