Skip to content

Commit 3860ea8

Browse files
committed
Handle upstream httpclient changes gracefully
1 parent 3385388 commit 3860ea8

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

docker-java-transport-httpclient5/src/main/java/com/github/dockerjava/httpclient5/ApacheDockerHttpClientImpl.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import javax.net.ssl.SSLContext;
3939
import java.io.IOException;
4040
import java.io.InputStream;
41+
import java.net.InetSocketAddress;
4142
import java.net.Socket;
4243
import java.net.URI;
4344
import java.time.Duration;
@@ -147,17 +148,31 @@ private Registry<ConnectionSocketFactory> createConnectionSocketFactoryRegistry(
147148
return socketFactoryRegistryBuilder
148149
.register("tcp", PlainConnectionSocketFactory.INSTANCE)
149150
.register("http", PlainConnectionSocketFactory.INSTANCE)
150-
.register("unix", new PlainConnectionSocketFactory() {
151+
.register("unix", new ConnectionSocketFactory() {
151152
@Override
152153
public Socket createSocket(HttpContext context) throws IOException {
153154
return UnixSocket.get(dockerHost.getPath());
154155
}
156+
157+
@Override
158+
public Socket connectSocket(TimeValue timeValue, Socket socket, HttpHost httpHost, InetSocketAddress inetSocketAddress,
159+
InetSocketAddress inetSocketAddress1, HttpContext httpContext) throws IOException {
160+
return PlainConnectionSocketFactory.INSTANCE.connectSocket(timeValue, socket, httpHost, inetSocketAddress,
161+
inetSocketAddress1, httpContext);
162+
}
155163
})
156-
.register("npipe", new PlainConnectionSocketFactory() {
164+
.register("npipe", new ConnectionSocketFactory() {
157165
@Override
158166
public Socket createSocket(HttpContext context) {
159167
return new NamedPipeSocket(dockerHost.getPath());
160168
}
169+
170+
@Override
171+
public Socket connectSocket(TimeValue timeValue, Socket socket, HttpHost httpHost, InetSocketAddress inetSocketAddress,
172+
InetSocketAddress inetSocketAddress1, HttpContext httpContext) throws IOException {
173+
return PlainConnectionSocketFactory.INSTANCE.connectSocket(timeValue, socket, httpHost, inetSocketAddress,
174+
inetSocketAddress1, httpContext);
175+
}
161176
})
162177
.build();
163178
}

0 commit comments

Comments
 (0)