private static void addSslSocketFactory(HttpClientBuilder builder, HttpClientConnectionManagerFactory connectionManagerFactory,
                                            HostnameVerifier hostnameVerifier) {
        getSystemTlsContext().ifPresent(tlsContext -> {
            SSLConnectionSocketFactory socketFactory = SslConnectionSocketFactory.of(tlsContext, hostnameVerifier);
            builder.setConnectionManager(connectionManagerFactory.create(createRegistry(socketFactory)));
            // Workaround that allows re-using https connections, see https://stackoverflow.com/a/42112034/1615280 for details.
            // Proper solution would be to add a request interceptor that adds a x500 principal as user token,
            // but certificate subject CN is not accessible through the TlsContext currently.
            builder.setUserTokenHandler((route, context) -> null);
        });
    }
Sync HTTP client builder <em>for internal Vespa communications over http/https.</em>
Configures Vespa mTLS and handles TLS mixed mode automatically.
Custom connection managers must be configured through {@link #connectionManagerFactory(HttpClientConnectionManagerFactory)}.

@author jonmv
http-utils/src/main/java/ai/vespa/util/http/hc5/VespaHttpClientBuilder.java