Skip to content

Commit 3514b3b

Browse files
authored
Remove exclusion and fix httpclient5 compatibility (#2294)
Fixes #2290
1 parent 4d8c436 commit 3514b3b

2 files changed

Lines changed: 17 additions & 8 deletions

File tree

docker-java-transport-httpclient5/pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@
3030
<groupId>org.apache.httpcomponents.client5</groupId>
3131
<artifactId>httpclient5</artifactId>
3232
<version>5.0.3</version>
33-
<exclusions>
34-
<exclusion>
35-
<groupId>org.apache.httpcomponents.core5</groupId>
36-
<artifactId>httpcore5-h2</artifactId>
37-
</exclusion>
38-
</exclusions>
3933
</dependency>
4034

4135
<dependency>

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)