diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/socket/PlainConnectionSocketFactory.java b/httpclient5/src/main/java/org/apache/hc/client5/http/socket/PlainConnectionSocketFactory.java index 13495f9af..ce2d8fb40 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/socket/PlainConnectionSocketFactory.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/socket/PlainConnectionSocketFactory.java @@ -63,7 +63,7 @@ public class PlainConnectionSocketFactory implements ConnectionSocketFactory { @Override public Socket createSocket(final Proxy proxy, final HttpContext context) throws IOException { - return proxy != null ? new Socket(proxy) : new Socket(); + return proxy != null ? new Socket(proxy) : createSocket(context); } @Override diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactory.java b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactory.java index 7ca209cb1..9925c9a80 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactory.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactory.java @@ -206,7 +206,7 @@ public class SSLConnectionSocketFactory implements LayeredConnectionSocketFactor @Override public Socket createSocket(final Proxy proxy, final HttpContext context) throws IOException { - return proxy != null ? new Socket(proxy) : new Socket(); + return proxy != null ? new Socket(proxy) : createSocket(context); } @Override