Source:
<code>public void init(DockerClientConfig dockerClientConfig) { super.init(dockerClientConfig); OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder() .readTimeout(0, TimeUnit.SECONDS) .retryOnConnectionFailure(true); URI dockerHost = dockerClientConfig.getDockerHost(); switch (dockerHost.getScheme()) { case "unix": case "npipe": String socketPath = dockerHost.getPath(); if ("unix".equals(dockerHost.getScheme())) { clientBuilder .socketFactory(new UnixSocketFactory(socketPath)); } else { clientBuilder .socketFactory(new NamedPipeSocketFactory(socketPath)); } clientBuilder .connectionPool(new ConnectionPool(0, 1, TimeUnit.SECONDS)) .dns(hostname -> { if (hostname.endsWith(SOCKET_SUFFIX)) { return Collections.singletonList(InetAddress.getByAddress(hostname, new byte[]{0, 0, 0, 0})); } else { return Dns.SYSTEM.lookup(hostname); } }); } SSLConfig sslConfig = dockerClientConfig.getSSLConfig(); if (sslConfig != null) { SSLContext sslContext = sslConfig.getSSLContext(); if (sslContext != null) { clientBuilder <START> .sslSocketFactory(sslContext.getSocketFactory(), new TrustAllX509TrustManager()); <END> } } okHttpClient = clientBuilder.build(); HttpUrl.Builder baseUrlBuilder; switch (dockerHost.getScheme()) { case "unix": case "npipe": baseUrlBuilder = new HttpUrl.Builder() .scheme("http") .host("docker" + SOCKET_SUFFIX); break; case "tcp": baseUrlBuilder = new HttpUrl.Builder() .scheme(sslConfig != null && sslConfig.getSSLContext() != null ? "https" : "http") .host(dockerHost.getHost()) .port(dockerHost.getPort()); break; default: baseUrlBuilder = Internal.instance.getHttpUrlChecked(dockerHost.toString()).newBuilder(); } baseUrl = baseUrlBuilder.build(); }</code><technical_language>relevant for this PR, curious: is TrustAllX509TrustManager necessary</technical_language>

Target:
public void init(DockerClientConfig dockerClientConfig) { super.init(dockerClientConfig); OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder() .readTimeout(0, TimeUnit.SECONDS) .retryOnConnectionFailure(true); URI dockerHost = dockerClientConfig.getDockerHost(); switch (dockerHost.getScheme()) { case "unix": case "npipe": String socketPath = dockerHost.getPath(); if ("unix".equals(dockerHost.getScheme())) { clientBuilder .socketFactory(new UnixSocketFactory(socketPath)); } else { clientBuilder .socketFactory(new NamedPipeSocketFactory(socketPath)); } clientBuilder .connectionPool(new ConnectionPool(0, 1, TimeUnit.SECONDS)) .dns(hostname -> { if (hostname.endsWith(SOCKET_SUFFIX)) { return Collections.singletonList(InetAddress.getByAddress(hostname, new byte[]{0, 0, 0, 0})); } else { return Dns.SYSTEM.lookup(hostname); } }); default: } SSLConfig sslConfig = dockerClientConfig.getSSLConfig(); if (sslConfig != null) { SSLContext sslContext = sslConfig.getSSLContext(); if (sslContext != null) { clientBuilder .sslSocketFactory(sslContext.getSocketFactory(), new TrustAllX509TrustManager()); } } okHttpClient = clientBuilder.build(); HttpUrl.Builder baseUrlBuilder; switch (dockerHost.getScheme()) { case "unix": case "npipe": baseUrlBuilder = new HttpUrl.Builder() .scheme("http") .host("docker" + SOCKET_SUFFIX); break; case "tcp": baseUrlBuilder = new HttpUrl.Builder() .scheme(sslConfig != null && sslConfig.getSSLContext() != null ? "https" : "http") .host(dockerHost.getHost()) .port(dockerHost.getPort()); break; default: baseUrlBuilder = Internal.instance.getHttpUrlChecked(dockerHost.toString()).newBuilder(); } baseUrl = baseUrlBuilder.build(); }