Source:
<code>private DefaultDockerClient(final Builder builder) { URI originalUri = checkNotNull(builder.uri, "uri"); if ((builder.dockerCertificates != null) && !originalUri.getScheme().equals("https")) { throw new IllegalArgumentException("https URI must be provided to use certificates"); } if (originalUri.getScheme().equals(UNIX_SCHEME)) { this.uri = UnixConnectionSocketFactory.sanitizeUri(originalUri); } else { this.uri = originalUri; } final PoolingHttpClientConnectionManager cm = getConnectionManager(builder); final PoolingHttpClientConnectionManager noTimeoutCm = getConnectionManager(builder); cm.setDefaultMaxPerRoute(cm.getMaxTotal()); cm.setMaxTotal(builder.connectionPoolSize); final RequestConfig requestConfig = RequestConfig.custom() .setConnectionRequestTimeout((int) builder.connectTimeoutMillis) .setConnectTimeout((int) builder.connectTimeoutMillis) .setSocketTimeout((int) builder.readTimeoutMillis) .build(); final ClientConfig config = DEFAULT_CONFIG .connectorProvider(new ApacheConnectorProvider()) .property(ApacheClientProperties.CONNECTION_MANAGER, cm) .property(ApacheClientProperties.REQUEST_CONFIG, requestConfig); this.client = ClientBuilder.newClient(config); final RequestConfig noReadTimeoutRequestConfig = RequestConfig.copy(requestConfig) .setSocketTimeout((int) NO_TIMEOUT) .build(); <START> this.noTimeoutClient = ClientBuilder.newBuilder() <END> .withConfig(config) .property(ApacheClientProperties.CONNECTION_MANAGER, noTimeoutCm) .property(ApacheClientProperties.REQUEST_CONFIG, noReadTimeoutRequestConfig) .build(); }</code><technical_language>If this throws exception, I leak 2 connection managers other client guess is call close. wrap 4 objects in a try/catch call close if exception is thrown</technical_language>

Target:
private DefaultDockerClient(final Builder builder) { URI originalUri = checkNotNull(builder.uri, "uri"); if ((builder.dockerCertificates != null) && !originalUri.getScheme().equals("https")) { throw new IllegalArgumentException("https URI must be provided to use certificates"); } if (originalUri.getScheme().equals(UNIX_SCHEME)) { this.uri = UnixConnectionSocketFactory.sanitizeUri(originalUri); } else { this.uri = originalUri; } final PoolingHttpClientConnectionManager cm = getConnectionManager(builder); final PoolingHttpClientConnectionManager noTimeoutCm = getConnectionManager(builder); final RequestConfig requestConfig = RequestConfig.custom() .setConnectionRequestTimeout((int) builder.connectTimeoutMillis) .setConnectTimeout((int) builder.connectTimeoutMillis) .setSocketTimeout((int) builder.readTimeoutMillis) .build(); final ClientConfig config = DEFAULT_CONFIG .connectorProvider(new ApacheConnectorProvider()) .property(ApacheClientProperties.CONNECTION_MANAGER, cm) .property(ApacheClientProperties.REQUEST_CONFIG, requestConfig); this.client = ClientBuilder.newClient(config); final RequestConfig noReadTimeoutRequestConfig = RequestConfig.copy(requestConfig) .setSocketTimeout((int) NO_TIMEOUT) .build(); this.noTimeoutClient = ClientBuilder.newBuilder() .withConfig(config) .property(ApacheClientProperties.CONNECTION_MANAGER, noTimeoutCm) .property(ApacheClientProperties.REQUEST_CONFIG, noReadTimeoutRequestConfig) .build(); }