From 1d09a8308f271d8d255681d5599811b2fff43c7f Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Mon, 22 Sep 2014 14:10:17 +0000 Subject: [PATCH] Use non-zero connect timeout as SSL handshake handshake (socket) timeout if not explicitly set by the caller (socket timeout is zero) git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1626782 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/http/conn/ssl/SSLConnectionSocketFactory.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/httpclient/src/main/java/org/apache/http/conn/ssl/SSLConnectionSocketFactory.java b/httpclient/src/main/java/org/apache/http/conn/ssl/SSLConnectionSocketFactory.java index 6dca47516..9a5177297 100644 --- a/httpclient/src/main/java/org/apache/http/conn/ssl/SSLConnectionSocketFactory.java +++ b/httpclient/src/main/java/org/apache/http/conn/ssl/SSLConnectionSocketFactory.java @@ -320,6 +320,9 @@ public class SSLConnectionSocketFactory implements LayeredConnectionSocketFactor sock.bind(localAddress); } try { + if (connectTimeout > 0 && sock.getSoTimeout() == 0) { + sock.setSoTimeout(connectTimeout); + } sock.connect(remoteAddress, connectTimeout); } catch (final IOException ex) { try {