Before handshake during https request, if connectTimeout is set alone,
without socketTimeout, SSLConnectionSocketFactory#connectSocket will
override socketTimeout with connectTimeout and never change back, anyone
know why? is it a flaw or feature?
HttpClient version: 4.5.3
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.3</version>
</dependency>
Example: ( SocketTimeout of the socket will be 2000ms. )
public static void main(String[] args) throws IOException {
HttpGet httpGet = new HttpGet("https://www.google.com");
httpGet.setConfig(RequestConfig.custom().setConnectTimeout(2000).build());
CloseableHttpClient httpclient = HttpClients.createDefault();
CloseableHttpResponse response = httpclient.execute(httpGet);
try {
System.out.println(EntityUtils.toString(response.getEntity()));
} finally {
response.close();
}
}
Commit history:
https://github.com/apache/httpcomponents-client/commit/d954cd287dfcdad8f153e61181e20d253175ca8c
Issue before:
https://issues.apache.org/jira/browse/HTTPCLIENT-1589