@@ -0,0 +1,2328 @@
+package ai.vespa.util.http.hc5;%0A%0Aimport org.apache.hc.client5.http.config.RequestConfig;%0Aimport org.apache.hc.client5.http.impl.classic.HttpClientBuilder;%0Aimport org.apache.hc.client5.http.impl.classic.HttpClients;%0Aimport org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder;%0Aimport org.apache.hc.client5.http.ssl.SSLConnectionSocketFactoryBuilder;%0Aimport org.apache.hc.core5.http.ContentType;%0Aimport org.apache.hc.core5.http.HttpHeaders;%0Aimport org.apache.hc.core5.util.Timeout;%0A%0Aimport javax.net.ssl.SSLContext;%0Aimport java.time.Duration;%0Aimport java.util.Map;%0Aimport java.util.function.Supplier;%0A%0A/**%0A * Like %7B@link VespaHttpClientBuilder%7D, but with standard TLS based on provided SSL context.%0A *%0A * @author jonmv%0A */%0Apublic class DefaultHttpClientBuilder %7B%0A%0A    public static final Duration connectTimeout = Duration.ofSeconds(5);%0A    public static final Duration socketTimeout = Duration.ofSeconds(5);%0A%0A    private DefaultHttpClientBuilder() %7B %7D%0A%0A    public static HttpClientBuilder create(SSLContext sslContext, String userAgent) %7B%0A        return create(() -%3E sslContext, userAgent);%0A    %7D%0A%0A    /** Creates an HTTP client builder with the given SSL context, and using the provided timeouts for requests where config is not overridden. */%0A    public static HttpClientBuilder create(Supplier%3CSSLContext%3E sslContext, String userAgent) %7B%0A        return HttpClientBuilder.create()%0A                                .setConnectionManager(PoolingHttpClientConnectionManagerBuilder%0A                                                              .create()%0A                                                              .setSSLSocketFactory(SSLConnectionSocketFactoryBuilder%0A                                                                                           .create()%0A                                                                                           .setSslContext(sslContext.get())%0A                                                                                           .build())%0A                                                              .build())%0A                                .setUserAgent(userAgent)%0A                                .disableCookieManagement()%0A                                .disableAutomaticRetries()%0A                                .disableAuthCaching();%0A    %7D%0A%0A%7D%0A

Add DefaultHttpClientBuidler for easy SSLContext