Source:
public void init(DockerClientConfig dockerClientConfig) { super.init(dockerClientConfig); OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder() .hostnameVerifier(new HostnameVerifier() { @Override public boolean verify(String hostname, SSLSession session) { return true; } }) .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 = HttpUrl.get(dockerHost.toString()).newBuilder(); } baseUrl = baseUrlBuilder.build(); }

Target:
public void init(DockerClientConfig dockerClientConfig) { super.init(dockerClientConfig); OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder() .hostnameVerifier((hostname, sslSession) -> true) .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 = HttpUrl.get(dockerHost.toString()).newBuilder(); } baseUrl = baseUrlBuilder.build(); }