diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpAsyncClients.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpAsyncClients.java index 8b20b9825d..323d4d89e5 100644 --- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpAsyncClients.java +++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpAsyncClients.java @@ -43,10 +43,31 @@ private CachingHttpAsyncClients() { super(); } + /** + * @since 5.7 + */ + public static CachingHttpAsyncClientBuilder builder() { + return CachingHttpAsyncClientBuilder.create(); + } + + /** + * Creates {@link CloseableHttpAsyncClient} instance with default + * configuration. + * + * @since 5.7 + */ + public static CloseableHttpAsyncClient create() { + return CachingHttpAsyncClientBuilder.create().build(); + } + /** * Creates builder object for construction of custom * {@link CloseableHttpAsyncClient} instances. + * + * @deprecated Use {@link #builder()} + * @see CachingHttpAsyncClientBuilder#ignoreSystemProperties() */ + @Deprecated public static CachingHttpAsyncClientBuilder custom() { return CachingHttpAsyncClientBuilder.create(); } @@ -54,7 +75,10 @@ public static CachingHttpAsyncClientBuilder custom() { /** * Creates {@link CloseableHttpAsyncClient} instance that uses a memory bound * response cache. + * + * @deprecated Use {@link #builder()} */ + @Deprecated public static CloseableHttpAsyncClient createMemoryBound() { return CachingHttpAsyncClientBuilder.create().build(); } @@ -64,7 +88,10 @@ public static CloseableHttpAsyncClient createMemoryBound() { * bound response cache. * * @param cacheDir location of response cache. + * + * @deprecated Use {@link #builder()} */ + @Deprecated public static CloseableHttpAsyncClient createFileBound(final File cacheDir) { return CachingHttpAsyncClientBuilder.create().setCacheDir(cacheDir).build(); } @@ -72,15 +99,31 @@ public static CloseableHttpAsyncClient createFileBound(final File cacheDir) { /** * Creates builder object for construction of custom HTTP/2 * {@link CloseableHttpAsyncClient} instances. + * + * @since 5.7 */ - public static CachingH2AsyncClientBuilder customHttp2() { + public static CachingH2AsyncClientBuilder http2Builder() { return CachingH2AsyncClientBuilder.create(); } + /** + * Creates builder object for construction of custom HTTP/2 + * {@link CloseableHttpAsyncClient} instances. + * + * @deprecated Use {@link #http2Builder()} + */ + @Deprecated + public static CachingH2AsyncClientBuilder customHttp2() { + return (CachingH2AsyncClientBuilder) CachingH2AsyncClientBuilder.create().ignoreSystemProperties(); + } + /** * Creates HTTP/2 {@link CloseableHttpAsyncClient} instance that uses a memory bound * response cache. + * + * @deprecated Use {@link #http2Builder()} */ + @Deprecated public static CloseableHttpAsyncClient createHttp2MemoryBound() { return CachingH2AsyncClientBuilder.create().build(); } @@ -90,9 +133,15 @@ public static CloseableHttpAsyncClient createHttp2MemoryBound() { * bound response cache. * * @param cacheDir location of response cache. + * + * @deprecated Use {@link #http2Builder()} */ + @Deprecated public static CloseableHttpAsyncClient createHttp2FileBound(final File cacheDir) { - return CachingH2AsyncClientBuilder.create().setCacheDir(cacheDir).build(); + return CachingH2AsyncClientBuilder.create() + .setCacheDir(cacheDir) + .ignoreSystemProperties() + .build(); } } diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpClients.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpClients.java index c8cf99a34b..173b75d366 100644 --- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpClients.java +++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpClients.java @@ -43,10 +43,31 @@ private CachingHttpClients() { super(); } + /** + * @since 5.7 + */ + public static CachingHttpClientBuilder builder() { + return CachingHttpClientBuilder.create(); + } + + /** + * Creates {@link CloseableHttpClient} instance with default + * configuration. + * + * @since 5.7 + */ + public static CloseableHttpClient create() { + return CachingHttpClientBuilder.create().build(); + } + /** * Creates builder object for construction of custom * {@link CloseableHttpClient} instances. + * + * @deprecated Use {@link #builder()} + * @see CachingHttpClientBuilder#ignoreSystemProperties() */ + @Deprecated public static CachingHttpClientBuilder custom() { return CachingHttpClientBuilder.create(); } @@ -54,7 +75,10 @@ public static CachingHttpClientBuilder custom() { /** * Creates {@link CloseableHttpClient} instance that uses a memory bound * response cache. + * + * @deprecated Use {@link #builder()} */ + @Deprecated public static CloseableHttpClient createMemoryBound() { return CachingHttpClientBuilder.create().build(); } @@ -64,7 +88,10 @@ public static CloseableHttpClient createMemoryBound() { * bound response cache. * * @param cacheDir location of response cache. + * + * @deprecated Use {@link #builder()} */ + @Deprecated public static CloseableHttpClient createFileBound(final File cacheDir) { return CachingHttpClientBuilder.create().setCacheDir(cacheDir).build(); } diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/cache/example/AsyncClientCacheControl.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/cache/example/AsyncClientCacheControl.java index f06cc62fa7..6bce617c69 100644 --- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/cache/example/AsyncClientCacheControl.java +++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/cache/example/AsyncClientCacheControl.java @@ -56,7 +56,7 @@ public static void main(final String[] args) throws Exception { final HttpHost target = new HttpHost("https", "www.apache.org"); - try (final CloseableHttpAsyncClient httpclient = CachingHttpAsyncClients.custom() + try (final CloseableHttpAsyncClient httpclient = CachingHttpAsyncClients.builder() .setCacheConfig(CacheConfig.custom() .setMaxObjectSize(200000) .setHeuristicCachingEnabled(true) diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/cache/example/ClientCacheControl.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/cache/example/ClientCacheControl.java index 311842c481..0aa1cae080 100644 --- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/cache/example/ClientCacheControl.java +++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/cache/example/ClientCacheControl.java @@ -50,7 +50,7 @@ public static void main(final String[] args) throws Exception { final HttpHost target = new HttpHost("https", "www.apache.org"); - try (final CloseableHttpClient httpclient = CachingHttpClients.custom() + try (final CloseableHttpClient httpclient = CachingHttpClients.builder() .setCacheConfig(CacheConfig.custom() .setMaxObjectSize(200000) .setHeuristicCachingEnabled(true) diff --git a/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Executor.java b/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Executor.java index 7527ae7070..a1adb84a92 100644 --- a/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Executor.java +++ b/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Executor.java @@ -77,14 +77,12 @@ static CloseableHttpClient GET_CLASSIC_CLIENT() { if (CLIENT == null) { CLIENT = HttpClientBuilder.create() .setConnectionManager(PoolingHttpClientConnectionManagerBuilder.create() - .useSystemProperties() .setMaxConnPerRoute(100) .setMaxConnTotal(200) .setDefaultConnectionConfig(ConnectionConfig.custom() .setValidateAfterInactivity(TimeValue.ofSeconds(10)) .build()) .build()) - .useSystemProperties() .evictExpiredConnections() .evictIdleConnections(TimeValue.ofMinutes(1)) .build(); @@ -105,7 +103,6 @@ static CloseableHttpClient GET_ASYNC_CLIENT() { if (ASYNC_CLIENT == null) { ASYNC_CLIENT = new ClassicToAsyncAdaptor(HttpAsyncClientBuilder.create() .setConnectionManager(PoolingAsyncClientConnectionManagerBuilder.create() - .useSystemProperties() .setMaxConnPerRoute(100) .setMaxConnTotal(200) .setMessageMultiplexing(true) @@ -113,7 +110,6 @@ static CloseableHttpClient GET_ASYNC_CLIENT() { .setValidateAfterInactivity(TimeValue.ofSeconds(10)) .build()) .build()) - .useSystemProperties() .evictExpiredConnections() .evictIdleConnections(TimeValue.ofMinutes(1)) .build(), Timeout.ofMinutes(5)); diff --git a/httpclient5-observation/src/main/java/org/apache/hc/client5/http/observation/HttpClientObservationSupport.java b/httpclient5-observation/src/main/java/org/apache/hc/client5/http/observation/HttpClientObservationSupport.java index 044540e36c..eb0cd99b64 100644 --- a/httpclient5-observation/src/main/java/org/apache/hc/client5/http/observation/HttpClientObservationSupport.java +++ b/httpclient5-observation/src/main/java/org/apache/hc/client5/http/observation/HttpClientObservationSupport.java @@ -70,7 +70,7 @@ *
{@code
  * ObservationRegistry obs = ObservationRegistry.create();
  * MeterRegistry meters = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
- * HttpClientBuilder b = HttpClients.custom();
+ * HttpClientBuilder b = HttpClients.builder();
  *
  * HttpClientObservationSupport.enable(
  *     b, obs, meters,
diff --git a/httpclient5-observation/src/main/java/org/apache/hc/client5/http/observation/binder/ConnPoolMeters.java b/httpclient5-observation/src/main/java/org/apache/hc/client5/http/observation/binder/ConnPoolMeters.java
index d3d588d248..9371608b17 100644
--- a/httpclient5-observation/src/main/java/org/apache/hc/client5/http/observation/binder/ConnPoolMeters.java
+++ b/httpclient5-observation/src/main/java/org/apache/hc/client5/http/observation/binder/ConnPoolMeters.java
@@ -51,7 +51,7 @@
  * MeterRegistry meters = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
  * MetricConfig mc = MetricConfig.builder().prefix("http_client").build();
  *
- * HttpClientBuilder b = HttpClients.custom()
+ * HttpClientBuilder b = HttpClients.builder()
  *     .setConnectionManager(PoolingHttpClientConnectionManagerBuilder.create().build());
  *
  * // after the connection manager is attached to the builder:
diff --git a/httpclient5-observation/src/main/java/org/apache/hc/client5/http/observation/binder/ConnPoolMetersAsync.java b/httpclient5-observation/src/main/java/org/apache/hc/client5/http/observation/binder/ConnPoolMetersAsync.java
index 9ce1a66178..dd6e84bb15 100644
--- a/httpclient5-observation/src/main/java/org/apache/hc/client5/http/observation/binder/ConnPoolMetersAsync.java
+++ b/httpclient5-observation/src/main/java/org/apache/hc/client5/http/observation/binder/ConnPoolMetersAsync.java
@@ -51,7 +51,7 @@
  * MeterRegistry meters = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
  * MetricConfig mc = MetricConfig.builder().prefix("http_client").build();
  *
- * HttpAsyncClientBuilder b = HttpAsyncClients.custom()
+ * HttpAsyncClientBuilder b = HttpAsyncClients.builder()
  *     .setConnectionManager(PoolingAsyncClientConnectionManagerBuilder.create().build());
  *
  * // After the async connection manager is attached to the builder:
diff --git a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/HttpClientObservationSupportTest.java b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/HttpClientObservationSupportTest.java
index 025fc3aa6c..0f3e95f18f 100644
--- a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/HttpClientObservationSupportTest.java
+++ b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/HttpClientObservationSupportTest.java
@@ -95,7 +95,7 @@ void basicIoAndPoolMetricsRecorded() throws Exception {
                 .tagLevel(ObservingOptions.TagLevel.LOW)
                 .build();
 
-        final HttpClientBuilder b = HttpClients.custom().setConnectionManager(cm);
+        final HttpClientBuilder b = HttpClients.builder().setConnectionManager(cm);
         HttpClientObservationSupport.enable(b, observations, meters, opts, mc);
 
         // IMPORTANT: scheme-first ctor + RELATIVE PATH to avoid 421
diff --git a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/binder/ConnPoolMetersAsyncTest.java b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/binder/ConnPoolMetersAsyncTest.java
index 48a7c93b95..ab56c817c4 100644
--- a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/binder/ConnPoolMetersAsyncTest.java
+++ b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/binder/ConnPoolMetersAsyncTest.java
@@ -44,7 +44,7 @@ void registersGaugesWhenAsyncPoolPresent() throws Exception {
         final MeterRegistry reg = new SimpleMeterRegistry();
 
         final AsyncClientConnectionManager cm = PoolingAsyncClientConnectionManagerBuilder.create().build();
-        final HttpAsyncClientBuilder b = HttpAsyncClients.custom().setConnectionManager(cm);
+        final HttpAsyncClientBuilder b = HttpAsyncClients.builder().setConnectionManager(cm);
 
         ConnPoolMetersAsync.bindTo(b, reg);
 
@@ -59,7 +59,7 @@ void registersGaugesWhenAsyncPoolPresent() throws Exception {
     @Test
     void noExceptionIfNoAsyncPool() {
         final MeterRegistry reg = new SimpleMeterRegistry();
-        final HttpAsyncClientBuilder b = HttpAsyncClients.custom(); // no CM set
+        final HttpAsyncClientBuilder b = HttpAsyncClients.builder(); // no CM set
         ConnPoolMetersAsync.bindTo(b, reg);
         assertNull(reg.find("http.client.pool.leased").gauge());
     }
diff --git a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/binder/ConnPoolMetersTest.java b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/binder/ConnPoolMetersTest.java
index 8d02226c50..56e8ffabc6 100644
--- a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/binder/ConnPoolMetersTest.java
+++ b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/binder/ConnPoolMetersTest.java
@@ -44,7 +44,7 @@ void registersGaugesWhenPoolPresent() throws Exception {
         final MeterRegistry reg = new SimpleMeterRegistry();
 
         final HttpClientConnectionManager cm = PoolingHttpClientConnectionManagerBuilder.create().build();
-        final HttpClientBuilder b = HttpClients.custom().setConnectionManager(cm);
+        final HttpClientBuilder b = HttpClients.builder().setConnectionManager(cm);
 
         ConnPoolMeters.bindTo(b, reg);
 
@@ -59,7 +59,7 @@ void registersGaugesWhenPoolPresent() throws Exception {
     @Test
     void noExceptionIfNoPool() {
         final MeterRegistry reg = new SimpleMeterRegistry();
-        final HttpClientBuilder b = HttpClients.custom(); // no CM set
+        final HttpClientBuilder b = HttpClients.builder(); // no CM set
         // should not throw
         ConnPoolMeters.bindTo(b, reg);
         // and nothing registered
diff --git a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/AsyncMetricsDemo.java b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/AsyncMetricsDemo.java
index 9cb6101e00..53a959f8ed 100644
--- a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/AsyncMetricsDemo.java
+++ b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/AsyncMetricsDemo.java
@@ -68,7 +68,7 @@ public static void main(final String[] args) throws Exception {
                 .tagLevel(ObservingOptions.TagLevel.EXTENDED)
                 .build();
 
-        final HttpAsyncClientBuilder b = HttpAsyncClients.custom();
+        final HttpAsyncClientBuilder b = HttpAsyncClients.builder();
         HttpClientObservationSupport.enable(b, obs, reg, opts, mc);
 
         final CloseableHttpAsyncClient client = b.build();
diff --git a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/ClassicWithMetricConfigDemo.java b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/ClassicWithMetricConfigDemo.java
index ecf6ba3a73..d9cad933f7 100644
--- a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/ClassicWithMetricConfigDemo.java
+++ b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/ClassicWithMetricConfigDemo.java
@@ -69,7 +69,7 @@ public static void main(final String[] args) throws Exception {
                 .build();
 
         // 4) client + enable metrics
-        final HttpClientBuilder b = HttpClients.custom();
+        final HttpClientBuilder b = HttpClients.builder();
         HttpClientObservationSupport.enable(b, obs, reg, opts, mc);
 
         try (final CloseableHttpClient client = b.build()) {
diff --git a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/DnsMetricsDemo.java b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/DnsMetricsDemo.java
index 3712569d4d..8cccbf226d 100644
--- a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/DnsMetricsDemo.java
+++ b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/DnsMetricsDemo.java
@@ -28,11 +28,11 @@
 
 import java.util.EnumSet;
 
-import io.micrometer.observation.ObservationRegistry;
 import io.micrometer.core.instrument.Metrics;
-
+import io.micrometer.observation.ObservationRegistry;
 import io.micrometer.prometheusmetrics.PrometheusConfig;
 import io.micrometer.prometheusmetrics.PrometheusMeterRegistry;
+import org.apache.hc.client5.http.SystemDefaultDnsResolver;
 import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
 import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
 import org.apache.hc.client5.http.impl.classic.HttpClients;
@@ -41,12 +41,10 @@
 import org.apache.hc.client5.http.observation.HttpClientObservationSupport;
 import org.apache.hc.client5.http.observation.MetricConfig;
 import org.apache.hc.client5.http.observation.ObservingOptions;
-
 import org.apache.hc.client5.http.observation.impl.MeteredDnsResolver;
 import org.apache.hc.core5.http.ClassicHttpResponse;
-import org.apache.hc.core5.http.io.support.ClassicRequestBuilder;
-import org.apache.hc.client5.http.SystemDefaultDnsResolver;
 import org.apache.hc.core5.http.HttpHost;
+import org.apache.hc.core5.http.io.support.ClassicRequestBuilder;
 
 public final class DnsMetricsDemo {
 
@@ -82,7 +80,7 @@ public static void main(final String[] args) throws Exception {
                 .setDnsResolver(meteredResolver)
                 .build();
 
-        final HttpClientBuilder builder = HttpClients.custom()
+        final HttpClientBuilder builder = HttpClients.builder()
                 .setConnectionManager(cm);
 
         // record http timers/counters + pool gauges
diff --git a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/PoolGaugesDemo.java b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/PoolGaugesDemo.java
index ca4493b8e1..88326cd70c 100644
--- a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/PoolGaugesDemo.java
+++ b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/PoolGaugesDemo.java
@@ -64,7 +64,7 @@ public static void main(final String[] args) throws Exception {
 
         // Ensure a pooling manager is used so pool gauges exist
         final HttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
-        final HttpClientBuilder b = HttpClients.custom().setConnectionManager(cm);
+        final HttpClientBuilder b = HttpClients.builder().setConnectionManager(cm);
 
         HttpClientObservationSupport.enable(b, obs, reg, opts, mc);
 
diff --git a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/SpanSamplingDemo.java b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/SpanSamplingDemo.java
index b56c71bcca..2354a264a2 100644
--- a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/SpanSamplingDemo.java
+++ b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/SpanSamplingDemo.java
@@ -64,7 +64,7 @@ public static void main(final String[] args) throws Exception {
                 })
                 .build();
 
-        final HttpClientBuilder b = HttpClients.custom();
+        final HttpClientBuilder b = HttpClients.builder();
         HttpClientObservationSupport.enable(b, obs, reg, opts, mc);
 
         try (final CloseableHttpClient client = b.build()) {
diff --git a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/TagLevelDemo.java b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/TagLevelDemo.java
index cdc8af0176..1628a04eef 100644
--- a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/TagLevelDemo.java
+++ b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/TagLevelDemo.java
@@ -62,7 +62,7 @@ public static void main(final String[] args) throws Exception {
                 .tagLevel(ObservingOptions.TagLevel.LOW)
                 .build();
 
-        final HttpClientBuilder b1 = HttpClients.custom();
+        final HttpClientBuilder b1 = HttpClients.builder();
         HttpClientObservationSupport.enable(b1, observations, regLow, low, mcLow);
         try (final CloseableHttpClient c1 = b1.build()) {
             final ClassicHttpResponse r1 = c1.executeOpen(null, ClassicRequestBuilder.get(URL).build(), null);
@@ -81,7 +81,7 @@ public static void main(final String[] args) throws Exception {
                 .tagLevel(ObservingOptions.TagLevel.EXTENDED)
                 .build();
 
-        final HttpClientBuilder b2 = HttpClients.custom();
+        final HttpClientBuilder b2 = HttpClients.builder();
         HttpClientObservationSupport.enable(b2, observations, regExt, ext, mcExt);
         try (final CloseableHttpClient c2 = b2.build()) {
             final ClassicHttpResponse r2 = c2.executeOpen(null, ClassicRequestBuilder.get(URL).build(), null);
diff --git a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/TlsMetricsDemo.java b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/TlsMetricsDemo.java
index 9f81babcb8..dc30653c4f 100644
--- a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/TlsMetricsDemo.java
+++ b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/TlsMetricsDemo.java
@@ -83,7 +83,7 @@ public static void main(final String[] args) throws Exception {
                         .setTlsStrategy(meteredTls)
                         .build();
 
-        final HttpAsyncClientBuilder builder = HttpAsyncClients.custom()
+        final HttpAsyncClientBuilder builder = HttpAsyncClients.builder()
                 .setConnectionManager(cm);
 
         // Enable HTTP metrics (timers/counters, IO, etc.)
diff --git a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/TracingAndMetricsDemo.java b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/TracingAndMetricsDemo.java
index 2b00a98a9a..5778690551 100644
--- a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/TracingAndMetricsDemo.java
+++ b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/example/TracingAndMetricsDemo.java
@@ -99,7 +99,7 @@ public static void main(final String[] args) throws Exception {
         /* ----------------------------------------------------------------
          * 3)  Build classic client
          * ---------------------------------------------------------------- */
-        final HttpClientBuilder builder = HttpClients.custom();
+        final HttpClientBuilder builder = HttpClients.builder();
 
         final ObservingOptions obs = ObservingOptions.builder()
                 .metrics(EnumSet.allOf(ObservingOptions.MetricSet.class))
diff --git a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/impl/ObservationAsyncExecInterceptorTest.java b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/impl/ObservationAsyncExecInterceptorTest.java
index cfaaef024e..603d19a639 100644
--- a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/impl/ObservationAsyncExecInterceptorTest.java
+++ b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/impl/ObservationAsyncExecInterceptorTest.java
@@ -108,7 +108,7 @@ void emitsObservationAroundAsyncCall() throws Exception {
                 .build();
 
         // 4) Async client with interceptor
-        final HttpAsyncClientBuilder b = HttpAsyncClients.custom();
+        final HttpAsyncClientBuilder b = HttpAsyncClients.builder();
         b.addExecInterceptorFirst("span", new ObservationAsyncExecInterceptor(reg, opts));
 
         final HttpHost target = new HttpHost("http", "localhost", port);
diff --git a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/impl/ObservationClassicExecInterceptorTest.java b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/impl/ObservationClassicExecInterceptorTest.java
index 4a7df7b839..88202a8117 100644
--- a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/impl/ObservationClassicExecInterceptorTest.java
+++ b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/impl/ObservationClassicExecInterceptorTest.java
@@ -104,7 +104,7 @@ void emitsObservationAroundClassicCall() throws Exception {
                 .build();
 
         // Build classic client with the observation interceptor FIRST
-        final HttpClientBuilder b = HttpClients.custom();
+        final HttpClientBuilder b = HttpClients.builder();
         b.addExecInterceptorFirst("span", new ObservationClassicExecInterceptor(reg, opts));
 
         final HttpHost target = new HttpHost("http", "localhost", port);
diff --git a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/interceptors/AsyncIoByteCounterExecTest.java b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/interceptors/AsyncIoByteCounterExecTest.java
index a01a4ddce0..317b7d5e45 100644
--- a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/interceptors/AsyncIoByteCounterExecTest.java
+++ b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/interceptors/AsyncIoByteCounterExecTest.java
@@ -84,7 +84,7 @@ void countsAsyncRequestAndResponseBytes() throws Exception {
                 .tagLevel(ObservingOptions.TagLevel.LOW)
                 .build();
 
-        final HttpAsyncClientBuilder b = HttpAsyncClients.custom();
+        final HttpAsyncClientBuilder b = HttpAsyncClients.builder();
         // Attach the async IO byte counter interceptor under test
         b.addExecInterceptorFirst("io", new AsyncIoByteCounterExec(meters, opts, mc));
 
diff --git a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/interceptors/AsyncTimerExecTest.java b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/interceptors/AsyncTimerExecTest.java
index 8dfa57650c..1096df5a76 100644
--- a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/interceptors/AsyncTimerExecTest.java
+++ b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/interceptors/AsyncTimerExecTest.java
@@ -84,7 +84,7 @@ void recordsAsyncLatencyAndCounter() throws Exception {
                 .tagLevel(ObservingOptions.TagLevel.LOW)
                 .build();
 
-        final HttpAsyncClientBuilder b = HttpAsyncClients.custom();
+        final HttpAsyncClientBuilder b = HttpAsyncClients.builder();
         // Attach the async timer interceptor under test
         b.addExecInterceptorFirst("timer", new AsyncTimerExec(meters, opts, mc));
 
diff --git a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/interceptors/IoByteCounterExecTest.java b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/interceptors/IoByteCounterExecTest.java
index 1280fe685b..0104655ad8 100644
--- a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/interceptors/IoByteCounterExecTest.java
+++ b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/interceptors/IoByteCounterExecTest.java
@@ -86,7 +86,7 @@ void countsRequestAndResponseBytes() throws Exception {
                 .build();
 
         final HttpClientConnectionManager cm = PoolingHttpClientConnectionManagerBuilder.create().build();
-        final HttpClientBuilder b = HttpClients.custom().setConnectionManager(cm);
+        final HttpClientBuilder b = HttpClients.builder().setConnectionManager(cm);
 
         // Attach the IO byte counter interceptor under test
         b.addExecInterceptorFirst("io", new IoByteCounterExec(meters, opts, mc));
diff --git a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/interceptors/TimerExecTest.java b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/interceptors/TimerExecTest.java
index 97e7605769..86726a6b88 100644
--- a/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/interceptors/TimerExecTest.java
+++ b/httpclient5-observation/src/test/java/org/apache/hc/client5/http/observation/interceptors/TimerExecTest.java
@@ -85,7 +85,7 @@ void recordsLatencyAndCounter() throws Exception {
                 .build();
 
         final HttpClientConnectionManager cm = PoolingHttpClientConnectionManagerBuilder.create().build();
-        final HttpClientBuilder b = HttpClients.custom().setConnectionManager(cm);
+        final HttpClientBuilder b = HttpClients.builder().setConnectionManager(cm);
 
         // Attach the timer interceptor under test
         b.addExecInterceptorFirst("timer", new TimerExec(meters, opts, mc));
diff --git a/httpclient5-sse/src/main/java/org/apache/hc/client5/http/sse/SseExecutor.java b/httpclient5-sse/src/main/java/org/apache/hc/client5/http/sse/SseExecutor.java
index c9d92dc470..6017aa13b1 100644
--- a/httpclient5-sse/src/main/java/org/apache/hc/client5/http/sse/SseExecutor.java
+++ b/httpclient5-sse/src/main/java/org/apache/hc/client5/http/sse/SseExecutor.java
@@ -103,7 +103,6 @@ static CloseableHttpAsyncClient getSharedClient() {
             if (c == null) {
                 c = HttpAsyncClientBuilder.create()
                         .setConnectionManager(PoolingAsyncClientConnectionManagerBuilder.create()
-                                .useSystemProperties()
                                 .setMaxConnPerRoute(100)
                                 .setMaxConnTotal(200)
                                 .setMessageMultiplexing(true)
diff --git a/httpclient5-sse/src/test/java/org/apache/hc/client5/http/sse/example/ClientSseExample.java b/httpclient5-sse/src/test/java/org/apache/hc/client5/http/sse/example/ClientSseExample.java
index 249511bc0f..5d27eec4ac 100644
--- a/httpclient5-sse/src/test/java/org/apache/hc/client5/http/sse/example/ClientSseExample.java
+++ b/httpclient5-sse/src/test/java/org/apache/hc/client5/http/sse/example/ClientSseExample.java
@@ -42,8 +42,8 @@
 import org.apache.hc.client5.http.sse.EventSource;
 import org.apache.hc.client5.http.sse.EventSourceConfig;
 import org.apache.hc.client5.http.sse.EventSourceListener;
-import org.apache.hc.client5.http.sse.impl.ExponentialJitterBackoff;
 import org.apache.hc.client5.http.sse.SseExecutor;
+import org.apache.hc.client5.http.sse.impl.ExponentialJitterBackoff;
 import org.apache.hc.client5.http.sse.impl.SseParser;
 import org.apache.hc.core5.concurrent.DefaultThreadFactory;
 import org.apache.hc.core5.http2.HttpVersionPolicy;
@@ -67,7 +67,6 @@ public static void main(final String[] args) throws Exception {
 
         final PoolingAsyncClientConnectionManager connMgr =
                 PoolingAsyncClientConnectionManagerBuilder.create()
-                        .useSystemProperties()
                         .setMessageMultiplexing(true)      // HTTP/2 stream multiplexing
                         .setMaxConnPerRoute(32)
                         .setMaxConnTotal(256)
@@ -84,7 +83,6 @@ public static void main(final String[] args) throws Exception {
                         .setPushEnabled(false)
                         .setMaxConcurrentStreams(256)
                         .build())
-                .useSystemProperties()
                 .evictExpiredConnections()
                 .evictIdleConnections(TimeValue.ofMinutes(1))
                 .build();
diff --git a/httpclient5-sse/src/test/java/org/apache/hc/client5/http/sse/example/performance/SsePerfClient.java b/httpclient5-sse/src/test/java/org/apache/hc/client5/http/sse/example/performance/SsePerfClient.java
index 983aaee251..38249f8451 100644
--- a/httpclient5-sse/src/test/java/org/apache/hc/client5/http/sse/example/performance/SsePerfClient.java
+++ b/httpclient5-sse/src/test/java/org/apache/hc/client5/http/sse/example/performance/SsePerfClient.java
@@ -90,7 +90,6 @@ public static void main(final String[] args) throws Exception {
 
         final PoolingAsyncClientConnectionManager connMgr =
                 PoolingAsyncClientConnectionManagerBuilder.create()
-                        .useSystemProperties()
                         .setMessageMultiplexing(true) // enable H2 multiplexing if negotiated
                         .setMaxConnPerRoute(Math.max(64, connections))
                         .setMaxConnTotal(Math.max(128, connections))
@@ -107,7 +106,6 @@ public static void main(final String[] args) throws Exception {
                         .setPushEnabled(false)
                         .setMaxConcurrentStreams(512)
                         .build())
-                .useSystemProperties()
                 .evictExpiredConnections()
                 .evictIdleConnections(TimeValue.ofMinutes(1))
                 .build();
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/TestValidateAfterInactivity.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/TestValidateAfterInactivity.java
index 38e949b69c..a80dfc40c6 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/TestValidateAfterInactivity.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/TestValidateAfterInactivity.java
@@ -27,6 +27,27 @@
 
 package org.apache.hc.client5.testing;
 
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.apache.hc.core5.util.TimeValue.MAX_VALUE;
+import static org.apache.hc.core5.util.TimeValue.ZERO_MILLISECONDS;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.SocketException;
+import java.net.StandardSocketOptions;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.nio.ByteBuffer;
+import java.nio.channels.AsynchronousCloseException;
+import java.nio.channels.ServerSocketChannel;
+import java.nio.channels.SocketChannel;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
+
 import org.apache.hc.client5.http.async.methods.SimpleHttpRequest;
 import org.apache.hc.client5.http.async.methods.SimpleHttpResponse;
 import org.apache.hc.client5.http.async.methods.SimpleRequestBuilder;
@@ -46,27 +67,6 @@
 import org.junit.jupiter.api.Nested;
 import org.junit.jupiter.api.Test;
 
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.SocketException;
-import java.net.StandardSocketOptions;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.nio.ByteBuffer;
-import java.nio.channels.AsynchronousCloseException;
-import java.nio.channels.ServerSocketChannel;
-import java.nio.channels.SocketChannel;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicReference;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.apache.hc.core5.util.TimeValue.MAX_VALUE;
-import static org.apache.hc.core5.util.TimeValue.ZERO_MILLISECONDS;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-
 /**
  * Tests validateAfterInactivity behavior in both sync and async clients.
  */
@@ -252,7 +252,7 @@ private static void handleConnection(final SocketChannel socketChannel) throws I
     private CloseableHttpClient syncClient(final boolean validateAfterInactivity) {
         final PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager();
         connManager.setDefaultConnectionConfig(getConnectionConfig(validateAfterInactivity));
-        return HttpClients.custom()
+        return HttpClients.builder()
             .setConnectionManager(connManager)
             .disableAutomaticRetries()
             .build();
@@ -263,7 +263,7 @@ private CloseableHttpAsyncClient asyncClient(final boolean validateAfterInactivi
         connManager.setDefaultConnectionConfig(getConnectionConfig(validateAfterInactivity));
         connManager.setDefaultMaxPerRoute(1);
         connManager.setMaxTotal(1);
-        final CloseableHttpAsyncClient client = HttpAsyncClients.custom()
+        final CloseableHttpAsyncClient client = HttpAsyncClients.builder()
             .setConnectionManager(connManager)
             .disableAutomaticRetries()
             .build();
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestConnectionClosureRace.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestConnectionClosureRace.java
index b00bdc35e9..bb2a30f360 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestConnectionClosureRace.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestConnectionClosureRace.java
@@ -27,6 +27,32 @@
 
 package org.apache.hc.client5.testing.async;
 
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.apache.hc.core5.http2.HttpVersionPolicy.FORCE_HTTP_1;
+import static org.apache.hc.core5.http2.HttpVersionPolicy.FORCE_HTTP_2;
+import static org.apache.hc.core5.util.TimeValue.MAX_VALUE;
+import static org.apache.hc.core5.util.TimeValue.NEG_ONE_MILLISECOND;
+import static org.apache.hc.core5.util.TimeValue.ZERO_MILLISECONDS;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.net.ServerSocketFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLServerSocketFactory;
+import javax.net.ssl.SSLSocket;
+
 import org.apache.hc.client5.http.async.methods.SimpleHttpRequest;
 import org.apache.hc.client5.http.async.methods.SimpleHttpResponse;
 import org.apache.hc.client5.http.async.methods.SimpleRequestBuilder;
@@ -69,31 +95,6 @@
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.ValueSource;
 
-import javax.net.ServerSocketFactory;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLServerSocketFactory;
-import javax.net.ssl.SSLSocket;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.SocketException;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.Future;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.apache.hc.core5.http2.HttpVersionPolicy.FORCE_HTTP_1;
-import static org.apache.hc.core5.http2.HttpVersionPolicy.FORCE_HTTP_2;
-import static org.apache.hc.core5.util.TimeValue.MAX_VALUE;
-import static org.apache.hc.core5.util.TimeValue.NEG_ONE_MILLISECOND;
-import static org.apache.hc.core5.util.TimeValue.ZERO_MILLISECONDS;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
 /**
  * This test exercises a race condition between client connection reuse and server-initiated connection closure. The
  * test matrix consists of two protocols (HTTP/1.1 and HTTP/2), two connection layers (TCP and TLS 1.2), and two,
@@ -407,7 +408,7 @@ private CloseableHttpAsyncClient asyncClient(final boolean validateConnections)
         connManager.setDefaultConnectionConfig(getConnectionConfig(validateConnections));
         connManager.setDefaultMaxPerRoute(1);
         connManager.setMaxTotal(1);
-        final CloseableHttpAsyncClient client = HttpAsyncClients.custom()
+        final CloseableHttpAsyncClient client = HttpAsyncClients.builder()
             .setIOReactorConfig(IOReactorConfig.custom()
                 .setSelectInterval(TimeValue.ofMilliseconds(1000))
                 .setIoThreadCount(1)
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Async.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Async.java
index b6fdf02a46..2d05c3120c 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Async.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Async.java
@@ -110,7 +110,7 @@ void testSharedPool() throws Exception {
         assertThat(body1.length(), CoreMatchers.equalTo(2048));
 
 
-        try (final CloseableHttpAsyncClient httpclient2 = HttpAsyncClients.custom()
+        try (final CloseableHttpAsyncClient httpclient2 = HttpAsyncClients.builder()
                 .setConnectionManager(connManager)
                 .setConnectionManagerShared(true)
                 .build()) {
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Reactive.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Reactive.java
index 66d1e6c37f..287a43e3cd 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Reactive.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Reactive.java
@@ -122,7 +122,7 @@ void testSharedPool() throws Exception {
         assertThat(body1.length(), CoreMatchers.equalTo(2048));
 
 
-        try (final CloseableHttpAsyncClient httpclient2 = HttpAsyncClients.custom()
+        try (final CloseableHttpAsyncClient httpclient2 = HttpAsyncClients.builder()
                 .setConnectionManager(connManager)
                 .setConnectionManagerShared(true)
                 .build()) {
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/extension/async/HttpAsyncClientResource.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/extension/async/HttpAsyncClientResource.java
index 5212fd3437..ccabf69745 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/extension/async/HttpAsyncClientResource.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/extension/async/HttpAsyncClientResource.java
@@ -53,7 +53,7 @@ public class HttpAsyncClientResource implements AfterEachCallback {
 
     public HttpAsyncClientResource(final HttpVersionPolicy versionPolicy) throws IOException {
         try {
-            this.clientBuilder = HttpAsyncClients.custom()
+            this.clientBuilder = HttpAsyncClients.builder()
                     .setConnectionManager(PoolingAsyncClientConnectionManagerBuilder.create()
                             .setTlsStrategy(new DefaultClientTlsStrategy(SSLContexts.custom()
                                     .loadTrustMaterial(getClass().getResource("/test-ca.keystore"), "nopassword".toCharArray())
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/extension/sync/HttpClientResource.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/extension/sync/HttpClientResource.java
index 40577fd378..2301162432 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/extension/sync/HttpClientResource.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/extension/sync/HttpClientResource.java
@@ -51,7 +51,7 @@ public class HttpClientResource implements AfterEachCallback {
 
     public HttpClientResource() throws IOException {
         try {
-            this.clientBuilder = HttpClients.custom()
+            this.clientBuilder = HttpClients.builder()
                     .setConnectionManager(PoolingHttpClientConnectionManagerBuilder.create()
                             .setTlsSocketStrategy(new DefaultClientTlsStrategy(SSLContexts.custom()
                                     .loadTrustMaterial(getClass().getResource("/test-ca.keystore"), "nopassword".toCharArray())
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncClientBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncClientBuilder.java
index 998442faa5..6be9b4132b 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncClientBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncClientBuilder.java
@@ -70,6 +70,7 @@
 import org.apache.hc.client5.http.protocol.ResponseProcessCookies;
 import org.apache.hc.client5.http.routing.HttpRoutePlanner;
 import org.apache.hc.client5.http.ssl.DefaultClientTlsStrategy;
+import org.apache.hc.client5.http.ssl.HostnameVerificationPolicy;
 import org.apache.hc.core5.annotation.Experimental;
 import org.apache.hc.core5.annotation.Internal;
 import org.apache.hc.core5.concurrent.DefaultThreadFactory;
@@ -102,6 +103,7 @@
 import org.apache.hc.core5.reactor.IOReactorConfig;
 import org.apache.hc.core5.reactor.IOSession;
 import org.apache.hc.core5.reactor.IOSessionListener;
+import org.apache.hc.core5.ssl.SSLContexts;
 import org.apache.hc.core5.util.Args;
 import org.apache.hc.core5.util.TimeValue;
 import org.apache.hc.core5.util.VersionInfo;
@@ -198,7 +200,7 @@ private ExecInterceptorEntry(
     private boolean evictIdleConnections;
     private TimeValue maxIdleTime;
 
-    private boolean systemProperties;
+    private boolean ignoreSystemProperties;
     private boolean automaticRetriesDisabled;
     private boolean redirectHandlingDisabled;
     private boolean cookieManagementDisabled;
@@ -643,7 +645,20 @@ public final H2AsyncClientBuilder setDefaultConnectionConfig(final ConnectionCon
      * @return this instance.
      */
     public final H2AsyncClientBuilder useSystemProperties() {
-        this.systemProperties = true;
+        this.ignoreSystemProperties = false;
+        return this;
+    }
+
+    /**
+     * Ignore system properties when creating and configuring default
+     * implementations.
+     *
+     * @return this instance.
+     *
+     * @since 5.7
+     */
+    public final H2AsyncClientBuilder ignoreSystemProperties() {
+        this.ignoreSystemProperties = true;
         return this;
     }
 
@@ -751,7 +766,7 @@ public CloseableHttpAsyncClient build() {
 
         String userAgentCopy = this.userAgent;
         if (userAgentCopy == null) {
-            if (systemProperties) {
+            if (!ignoreSystemProperties) {
                 userAgentCopy = System.getProperty("http.agent", null);
             }
             if (userAgentCopy == null) {
@@ -932,7 +947,7 @@ public CloseableHttpAsyncClient build() {
 
         CredentialsProvider credentialsProviderCopy = this.credentialsProvider;
         if (credentialsProviderCopy == null) {
-            if (systemProperties) {
+            if (!ignoreSystemProperties) {
                 credentialsProviderCopy = new SystemDefaultCredentialsProvider();
             } else {
                 credentialsProviderCopy = new BasicCredentialsProvider();
@@ -941,10 +956,10 @@ public CloseableHttpAsyncClient build() {
 
         TlsStrategy tlsStrategyCopy = this.tlsStrategy;
         if (tlsStrategyCopy == null) {
-            if (systemProperties) {
-                tlsStrategyCopy = DefaultClientTlsStrategy.createSystemDefault();
+            if (!ignoreSystemProperties) {
+                tlsStrategyCopy = DefaultClientTlsStrategy.create();
             } else {
-                tlsStrategyCopy = DefaultClientTlsStrategy.createDefault();
+                tlsStrategyCopy = new DefaultClientTlsStrategy(SSLContexts.createDefault(), HostnameVerificationPolicy.BUILTIN, null);
             }
         }
 
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java
index b29ca5f768..17cce2feb7 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java
@@ -254,7 +254,7 @@ private ExecInterceptorEntry(
     private boolean evictIdleConnections;
     private TimeValue maxIdleTime;
 
-    private boolean systemProperties;
+    private boolean ignoreSystemProperties;
     private boolean automaticRetriesDisabled;
     private boolean redirectHandlingDisabled;
     private boolean cookieManagementDisabled;
@@ -769,7 +769,20 @@ public final HttpAsyncClientBuilder setDefaultRequestConfig(final RequestConfig
      * @return this instance.
      */
     public final HttpAsyncClientBuilder useSystemProperties() {
-        this.systemProperties = true;
+        this.ignoreSystemProperties = false;
+        return this;
+    }
+
+    /**
+     * Ignore system properties when creating and configuring default
+     * implementations.
+     *
+     * @return this instance.
+     *
+     * @since 5.7
+     */
+    public final HttpAsyncClientBuilder ignoreSystemProperties() {
+        this.ignoreSystemProperties = true;
         return this;
     }
 
@@ -967,7 +980,7 @@ public CloseableHttpAsyncClient build() {
         AsyncClientConnectionManager connManagerCopy = this.connManager;
         if (connManagerCopy == null) {
             final PoolingAsyncClientConnectionManagerBuilder connectionManagerBuilder = PoolingAsyncClientConnectionManagerBuilder.create();
-            if (systemProperties) {
+            if (!ignoreSystemProperties) {
                 connectionManagerBuilder.useSystemProperties();
             }
             connManagerCopy = connectionManagerBuilder.build();
@@ -998,7 +1011,7 @@ public CloseableHttpAsyncClient build() {
 
         String userAgentCopy = this.userAgent;
         if (userAgentCopy == null) {
-            if (systemProperties) {
+            if (!ignoreSystemProperties) {
                 userAgentCopy = System.getProperty("http.agent", null);
             }
             if (userAgentCopy == null) {
@@ -1118,7 +1131,7 @@ public CloseableHttpAsyncClient build() {
                 routePlannerCopy = new DefaultProxyRoutePlanner(proxy, schemePortResolverCopy);
             } else if (this.proxySelector != null) {
                 routePlannerCopy = new SystemDefaultRoutePlanner(schemePortResolverCopy, this.proxySelector);
-            } else if (systemProperties) {
+            } else if (!ignoreSystemProperties) {
                 final ProxySelector defaultProxySelector = ProxySelector.getDefault();
                 routePlannerCopy = new SystemDefaultRoutePlanner(schemePortResolverCopy, defaultProxySelector);
             } else {
@@ -1156,7 +1169,7 @@ public CloseableHttpAsyncClient build() {
         }
         ConnectionReuseStrategy reuseStrategyCopy = this.reuseStrategy;
         if (reuseStrategyCopy == null) {
-            if (systemProperties) {
+            if (!ignoreSystemProperties) {
                 final String s = System.getProperty("http.keepAlive", "true");
                 if ("true".equalsIgnoreCase(s)) {
                     reuseStrategyCopy = DefaultClientConnectionReuseStrategy.INSTANCE;
@@ -1239,7 +1252,7 @@ public CloseableHttpAsyncClient build() {
 
         CredentialsProvider credentialsProviderCopy = this.credentialsProvider;
         if (credentialsProviderCopy == null) {
-            if (systemProperties) {
+            if (!ignoreSystemProperties) {
                 credentialsProviderCopy = new SystemDefaultCredentialsProvider();
             } else {
                 credentialsProviderCopy = new BasicCredentialsProvider();
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClients.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClients.java
index 3ef487a8e6..1ee5aa6d33 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClients.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClients.java
@@ -71,50 +71,108 @@ private HttpAsyncClients() {
         super();
     }
 
+    /**
+     * @since 5.7
+     */
+    public static HttpAsyncClientBuilder builder() {
+        return HttpAsyncClientBuilder.create();
+    }
+
+    /**
+     * Creates {@link CloseableHttpAsyncClient} instance with default
+     * configuration.
+     *
+     * @since 5.7
+     */
+    public static CloseableHttpAsyncClient create() {
+        return HttpAsyncClientBuilder.create().build();
+    }
+
     /**
      * Creates builder object for construction of custom
      * {@link CloseableHttpAsyncClient} instances.
+     *
+     * @deprecated Use {@link #builder()}
+     * @see HttpAsyncClientBuilder#ignoreSystemProperties()
      */
+    @Deprecated
     public static HttpAsyncClientBuilder custom() {
-        return HttpAsyncClientBuilder.create();
+        return HttpAsyncClientBuilder.create().ignoreSystemProperties();
     }
 
     /**
      * Creates {@link CloseableHttpAsyncClient} instance with default configuration.
+     *
+     * @deprecated Use {@link #create()}
+     * @see HttpAsyncClientBuilder#ignoreSystemProperties()
      */
+    @Deprecated
     public static CloseableHttpAsyncClient createDefault() {
-        return HttpAsyncClientBuilder.create().build();
+        return HttpAsyncClientBuilder.create().ignoreSystemProperties().build();
     }
 
     /**
      * Creates {@link CloseableHttpAsyncClient} instance with default
      * configuration and system properties.
+     *
+     * @deprecated Use {@link #create()}
      */
+    @Deprecated
     public static CloseableHttpAsyncClient createSystem() {
         return HttpAsyncClientBuilder.create().useSystemProperties().build();
     }
 
+    /**
+     * Creates builder object for construction of custom HTTP/2
+     * {@link CloseableHttpAsyncClient} instances optimized for HTTP/2 protocol
+     * and message multiplexing.
+     *
+     * @since 5.7
+     */
+    public static HttpAsyncClientBuilder http2Builder() {
+        return HttpAsyncClientBuilder.create();
+    }
+
+    /**
+     * Creates HTTP/2 {@link CloseableHttpAsyncClient} instance with default configuration
+     * optimized for HTTP/2 protocol and message multiplexing.
+     *
+     * @since 5.7
+     */
+    public static CloseableHttpAsyncClient http2Create() {
+        return HttpAsyncClientBuilder.create().build();
+    }
+
     /**
      * Creates builder object for construction of custom HTTP/2
      * {@link CloseableHttpAsyncClient} instances optimized for HTTP/2 protocol
      * and message multiplexing
+     *
+     * @deprecated Use {@link #http2Builder()}
      */
+    @Deprecated
     public static H2AsyncClientBuilder customHttp2() {
-        return H2AsyncClientBuilder.create();
+        return H2AsyncClientBuilder.create().ignoreSystemProperties();
     }
 
     /**
      * Creates HTTP/2 {@link CloseableHttpAsyncClient} instance with default configuration
      * optimized for HTTP/2 protocol and message multiplexing.
+     *
+     * @deprecated Use {@link #http2Create()}
      */
+    @Deprecated
     public static CloseableHttpAsyncClient createHttp2Default() {
-        return H2AsyncClientBuilder.create().build();
+        return H2AsyncClientBuilder.create().ignoreSystemProperties().build();
     }
 
     /**
      * Creates HTTP/2 {@link CloseableHttpAsyncClient} instance with default configuration and
      * system properties optimized for HTTP/2 protocol and message multiplexing.
+     *
+     * @deprecated Use {@link #http2Create()}
      */
+    @Deprecated
     public static CloseableHttpAsyncClient createHttp2System() {
         return H2AsyncClientBuilder.create().useSystemProperties().build();
     }
@@ -227,20 +285,28 @@ public static MinimalHttpAsyncClient createMinimal(
      * Creates {@link MinimalHttpAsyncClient} instance optimized for
      * HTTP/1.1 and HTTP/2 message transport without advanced HTTP protocol
      * functionality.
+     *
+     * @deprecated Use {@link #createMinimal(H2Config, Http1Config, IOReactorConfig, AsyncClientConnectionManager)}
      */
+    @Deprecated
     public static MinimalHttpAsyncClient createMinimal(
             final H2Config h2Config,
             final Http1Config h1Config,
             final IOReactorConfig ioReactorConfig) {
         return createMinimal(h2Config, h1Config, ioReactorConfig,
-                PoolingAsyncClientConnectionManagerBuilder.create().build());
+                PoolingAsyncClientConnectionManagerBuilder.create()
+                        .ignoreSystemProperties()
+                        .build());
     }
 
     /**
      * Creates {@link MinimalHttpAsyncClient} instance optimized for
      * HTTP/1.1 and HTTP/2 message transport without advanced HTTP protocol
      * functionality.
+     *
+     * @deprecated Use {@link #createMinimal(H2Config, Http1Config, IOReactorConfig, AsyncClientConnectionManager)}
      */
+    @Deprecated
     public static MinimalHttpAsyncClient createMinimal(final H2Config h2Config, final Http1Config h1Config) {
         return createMinimal(HttpVersionPolicy.NEGOTIATE, h2Config, h1Config, IOReactorConfig.DEFAULT);
     }
@@ -249,7 +315,10 @@ public static MinimalHttpAsyncClient createMinimal(final H2Config h2Config, fina
      * Creates {@link MinimalHttpAsyncClient} instance optimized for
      * HTTP/1.1 and HTTP/2 message transport without advanced HTTP protocol
      * functionality.
+     *
+     * @deprecated Use {@link #createMinimal(AsyncClientConnectionManager)}
      */
+    @Deprecated
     public static MinimalHttpAsyncClient createMinimal() {
         return createMinimal(H2Config.DEFAULT, Http1Config.DEFAULT);
     }
@@ -321,17 +390,23 @@ public static MinimalH2AsyncClient createHttp2Minimal(
     /**
      * Creates {@link MinimalH2AsyncClient} instance optimized for HTTP/2 multiplexing message
      * transport without advanced HTTP protocol functionality.
+     *
+     * @deprecated Use {@link #createHttp2Minimal(H2Config, IOReactorConfig, TlsStrategy)}
      */
+    @Deprecated
     public static MinimalH2AsyncClient createHttp2Minimal(
             final H2Config h2Config,
             final IOReactorConfig ioReactorConfig) {
-        return createHttp2Minimal(h2Config, ioReactorConfig, DefaultClientTlsStrategy.createDefault());
+        return createHttp2Minimal(h2Config, ioReactorConfig, DefaultClientTlsStrategy.create());
     }
 
     /**
      * Creates {@link MinimalH2AsyncClient} instance optimized for HTTP/2 multiplexing message
      * transport without advanced HTTP protocol functionality.
+     *
+     * @deprecated Use {@link #createHttp2Minimal(H2Config, IOReactorConfig, TlsStrategy)}
      */
+    @Deprecated
     public static MinimalH2AsyncClient createHttp2Minimal(final H2Config h2Config) {
         return createHttp2Minimal(h2Config, IOReactorConfig.DEFAULT);
     }
@@ -339,7 +414,10 @@ public static MinimalH2AsyncClient createHttp2Minimal(final H2Config h2Config) {
     /**
      * Creates {@link MinimalH2AsyncClient} instance optimized for HTTP/2 multiplexing message
      * transport without advanced HTTP protocol functionality.
+     *
+     * @deprecated Use {@link #createHttp2Minimal(H2Config, IOReactorConfig, TlsStrategy)}
      */
+    @Deprecated
     public static MinimalH2AsyncClient createHttp2Minimal() {
         return createHttp2Minimal(H2Config.DEFAULT);
     }
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClientBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClientBuilder.java
index 3fada22452..ee1d3e182d 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClientBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClientBuilder.java
@@ -227,7 +227,7 @@ private ExecInterceptorEntry(
     private boolean evictIdleConnections;
     private TimeValue maxIdleTime;
 
-    private boolean systemProperties;
+    private boolean ignoreSystemProperties;
     private boolean redirectHandlingDisabled;
     private boolean automaticRetriesDisabled;
     private boolean contentCompressionDisabled;
@@ -727,7 +727,20 @@ public final HttpClientBuilder setDefaultRequestConfig(final RequestConfig confi
      * @return this instance.
      */
     public final HttpClientBuilder useSystemProperties() {
-        this.systemProperties = true;
+        this.ignoreSystemProperties = false;
+        return this;
+    }
+
+    /**
+     * Ignore system properties when creating and configuring default
+     * implementations.
+     *
+     * @return this instance.
+     *
+     * @since 5.7
+     */
+    public final HttpClientBuilder ignoreSystemProperties() {
+        this.ignoreSystemProperties = true;
         return this;
     }
 
@@ -854,14 +867,14 @@ public CloseableHttpClient build() {
         HttpClientConnectionManager connManagerCopy = this.connManager;
         if (connManagerCopy == null) {
             final PoolingHttpClientConnectionManagerBuilder connectionManagerBuilder = PoolingHttpClientConnectionManagerBuilder.create();
-            if (systemProperties) {
+            if (!ignoreSystemProperties) {
                 connectionManagerBuilder.useSystemProperties();
             }
             connManagerCopy = connectionManagerBuilder.build();
         }
         ConnectionReuseStrategy reuseStrategyCopy = this.reuseStrategy;
         if (reuseStrategyCopy == null) {
-            if (systemProperties) {
+            if (!ignoreSystemProperties) {
                 final String s = System.getProperty("http.keepAlive", "true");
                 if ("true".equalsIgnoreCase(s)) {
                     reuseStrategyCopy = DefaultClientConnectionReuseStrategy.INSTANCE;
@@ -896,7 +909,7 @@ public CloseableHttpClient build() {
 
         String userAgentCopy = this.userAgent;
         if (userAgentCopy == null) {
-            if (systemProperties) {
+            if (!ignoreSystemProperties) {
                 userAgentCopy = System.getProperty("http.agent");
             }
             if (userAgentCopy == null && !defaultUserAgentDisabled) {
@@ -1020,7 +1033,7 @@ public CloseableHttpClient build() {
                 routePlannerCopy = new DefaultProxyRoutePlanner(proxy, schemePortResolverCopy);
             } else if (this.proxySelector != null) {
                 routePlannerCopy = new SystemDefaultRoutePlanner(schemePortResolverCopy, this.proxySelector);
-            } else if (systemProperties) {
+            } else if (!ignoreSystemProperties) {
                 final ProxySelector defaultProxySelector = ProxySelector.getDefault();
                 routePlannerCopy = new SystemDefaultRoutePlanner(schemePortResolverCopy, defaultProxySelector);
             } else {
@@ -1099,7 +1112,7 @@ public CloseableHttpClient build() {
 
         CredentialsProvider defaultCredentialsProvider = this.credentialsProvider;
         if (defaultCredentialsProvider == null) {
-            if (systemProperties) {
+            if (!ignoreSystemProperties) {
                 defaultCredentialsProvider = new SystemDefaultCredentialsProvider();
             } else {
                 defaultCredentialsProvider = new BasicCredentialsProvider();
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClients.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClients.java
index 55ccb58309..45f7beca94 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClients.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClients.java
@@ -27,7 +27,7 @@
 
 package org.apache.hc.client5.http.impl.classic;
 
-import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager;
+import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder;
 import org.apache.hc.client5.http.io.HttpClientConnectionManager;
 
 /**
@@ -41,26 +41,52 @@ private HttpClients() {
         super();
     }
 
+    /**
+     * @since 5.7
+     */
+    public static HttpClientBuilder builder() {
+        return HttpClientBuilder.create();
+    }
+
+    /**
+     * Creates {@link CloseableHttpClient} instance with default
+     * configuration.
+     *
+     * @since 5.7
+     */
+    public static CloseableHttpClient create() {
+        return HttpClientBuilder.create().build();
+    }
+
     /**
      * Creates builder object for construction of custom
      * {@link CloseableHttpClient} instances.
+     *
+     * @deprecated Use {@link #builder()}
+     * @see HttpClientBuilder#ignoreSystemProperties()
      */
+    @Deprecated
     public static HttpClientBuilder custom() {
-        return HttpClientBuilder.create();
+        return HttpClientBuilder.create().ignoreSystemProperties();
     }
 
     /**
      * Creates {@link CloseableHttpClient} instance with default
      * configuration.
+     * @deprecated Use {@link #create()}
+     * @see HttpClientBuilder#ignoreSystemProperties()
      */
+    @Deprecated
     public static CloseableHttpClient createDefault() {
-        return HttpClientBuilder.create().build();
+        return HttpClientBuilder.create().ignoreSystemProperties().build();
     }
 
     /**
      * Creates {@link CloseableHttpClient} instance with default
      * configuration based on system properties.
+     * @deprecated Use {@link #create()}
      */
+    @Deprecated
     public static CloseableHttpClient createSystem() {
         return HttpClientBuilder.create().useSystemProperties().build();
     }
@@ -68,9 +94,14 @@ public static CloseableHttpClient createSystem() {
     /**
      * Creates {@link CloseableHttpClient} instance that implements
      * the most basic HTTP protocol support.
+     *
+     * @deprecated Use {@link #createMinimal(HttpClientConnectionManager)}
      */
+    @Deprecated
     public static MinimalHttpClient createMinimal() {
-        return new MinimalHttpClient(new PoolingHttpClientConnectionManager());
+        return new MinimalHttpClient(PoolingHttpClientConnectionManagerBuilder.create()
+                .ignoreSystemProperties()
+                .build());
     }
 
     /**
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/BasicHttpClientConnectionManager.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/BasicHttpClientConnectionManager.java
index d634d94682..0e6534414e 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/BasicHttpClientConnectionManager.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/BasicHttpClientConnectionManager.java
@@ -206,7 +206,7 @@ public BasicHttpClientConnectionManager(
     public BasicHttpClientConnectionManager() {
         this(new DefaultHttpClientConnectionOperator(null, null,
                 RegistryBuilder.create()
-                        .register(URIScheme.HTTPS.id, DefaultClientTlsStrategy.createDefault())
+                        .register(URIScheme.HTTPS.id, DefaultClientTlsStrategy.create())
                         .build()),
                 null);
     }
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java
index 1e464d7386..fc462dd576 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java
@@ -132,7 +132,7 @@ public class PoolingHttpClientConnectionManager
     public PoolingHttpClientConnectionManager() {
         this(new DefaultHttpClientConnectionOperator(null, null,
                 RegistryBuilder.create()
-                    .register(URIScheme.HTTPS.id, DefaultClientTlsStrategy.createDefault())
+                    .register(URIScheme.HTTPS.id, DefaultClientTlsStrategy.create())
                     .build()),
                 PoolConcurrencyPolicy.STRICT,
                 PoolReusePolicy.LIFO,
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManagerBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManagerBuilder.java
index ae62bdbe8f..0ecaa0ccf2 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManagerBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManagerBuilder.java
@@ -37,6 +37,7 @@
 import org.apache.hc.client5.http.io.HttpClientConnectionOperator;
 import org.apache.hc.client5.http.io.ManagedHttpClientConnection;
 import org.apache.hc.client5.http.ssl.DefaultClientTlsStrategy;
+import org.apache.hc.client5.http.ssl.HostnameVerificationPolicy;
 import org.apache.hc.client5.http.ssl.TlsSocketStrategy;
 import org.apache.hc.core5.annotation.Experimental;
 import org.apache.hc.core5.annotation.Internal;
@@ -50,16 +51,15 @@
 import org.apache.hc.core5.pool.ConnPoolListener;
 import org.apache.hc.core5.pool.PoolConcurrencyPolicy;
 import org.apache.hc.core5.pool.PoolReusePolicy;
+import org.apache.hc.core5.ssl.SSLContexts;
 import org.apache.hc.core5.util.TimeValue;
 
 /**
  * Builder for {@link PoolingHttpClientConnectionManager} instances.
  * 

* When a particular component is not explicitly set this class will - * use its default implementation. System properties will be taken - * into account when configuring the default implementations when - * {@link #useSystemProperties()} method is called prior to calling - * {@link #build()}. + * use its default implementation. The following system are taken into + * account. *

*
    *
  • ssl.TrustManagerFactory.algorithm
  • @@ -90,7 +90,7 @@ public class PoolingHttpClientConnectionManagerBuilder { private Resolver connectionConfigResolver; private Resolver tlsConfigResolver; - private boolean systemProperties; + private boolean ignoreSystemProperties; private int maxConnTotal; private int maxConnPerRoute; @@ -319,7 +319,20 @@ public final PoolingHttpClientConnectionManagerBuilder setValidateAfterInactivit * @return this instance. */ public final PoolingHttpClientConnectionManagerBuilder useSystemProperties() { - this.systemProperties = true; + this.ignoreSystemProperties = false; + return this; + } + + /** + * Ignore system properties when creating and configuring default + * implementations. + * + * @return this instance. + * + * @since 5.7 + */ + public final PoolingHttpClientConnectionManagerBuilder ignoreSystemProperties() { + this.ignoreSystemProperties = true; return this; } @@ -360,10 +373,10 @@ public PoolingHttpClientConnectionManager build() { if (tlsSocketStrategy != null) { tlsSocketStrategyCopy = tlsSocketStrategy; } else { - if (systemProperties) { - tlsSocketStrategyCopy = DefaultClientTlsStrategy.createSystemDefault(); + if (!ignoreSystemProperties) { + tlsSocketStrategyCopy = DefaultClientTlsStrategy.create(); } else { - tlsSocketStrategyCopy = DefaultClientTlsStrategy.createDefault(); + tlsSocketStrategyCopy = new DefaultClientTlsStrategy(SSLContexts.createDefault(), HostnameVerificationPolicy.BUILTIN, null); } } diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java index 48180774b2..f61542c2c3 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java @@ -136,7 +136,7 @@ public class PoolingAsyncClientConnectionManager implements AsyncClientConnectio public PoolingAsyncClientConnectionManager() { this(RegistryBuilder.create() - .register(URIScheme.HTTPS.getId(), DefaultClientTlsStrategy.createDefault()) + .register(URIScheme.HTTPS.getId(), DefaultClientTlsStrategy.create()) .build()); } diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManagerBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManagerBuilder.java index 0a30435268..cd1b110101 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManagerBuilder.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManagerBuilder.java @@ -35,6 +35,7 @@ import org.apache.hc.client5.http.nio.AsyncClientConnectionOperator; import org.apache.hc.client5.http.ssl.ConscryptClientTlsStrategy; import org.apache.hc.client5.http.ssl.DefaultClientTlsStrategy; +import org.apache.hc.client5.http.ssl.HostnameVerificationPolicy; import org.apache.hc.core5.annotation.Experimental; import org.apache.hc.core5.annotation.Internal; import org.apache.hc.core5.function.Resolver; @@ -45,6 +46,7 @@ import org.apache.hc.core5.pool.ConnPoolListener; import org.apache.hc.core5.pool.PoolConcurrencyPolicy; import org.apache.hc.core5.pool.PoolReusePolicy; +import org.apache.hc.core5.ssl.SSLContexts; import org.apache.hc.core5.util.ReflectionUtils; import org.apache.hc.core5.util.TimeValue; @@ -52,10 +54,8 @@ * Builder for {@link PoolingAsyncClientConnectionManager} instances. *

    * When a particular component is not explicitly set this class will - * use its default implementation. System properties will be taken - * into account when configuring the default implementations when - * {@link #useSystemProperties()} method is called prior to calling - * {@link #build()}. + * use its default implementation. The following system are taken into + * account. *

    *
      *
    • ssl.TrustManagerFactory.algorithm
    • @@ -82,7 +82,7 @@ public class PoolingAsyncClientConnectionManagerBuilder { private PoolConcurrencyPolicy poolConcurrencyPolicy; private PoolReusePolicy poolReusePolicy; - private boolean systemProperties; + private boolean ignoreSystemProperties; private int maxConnTotal; private int maxConnPerRoute; @@ -267,7 +267,20 @@ public final PoolingAsyncClientConnectionManagerBuilder setValidateAfterInactivi * @return this instance. */ public final PoolingAsyncClientConnectionManagerBuilder useSystemProperties() { - this.systemProperties = true; + this.ignoreSystemProperties = false; + return this; + } + + /** + * Ignore system properties when creating and configuring default + * implementations. + * + * @return this instance. + * + * @since 5.7 + */ + public final PoolingAsyncClientConnectionManagerBuilder ignoreSystemProperties() { + this.ignoreSystemProperties = true; return this; } @@ -308,16 +321,16 @@ public PoolingAsyncClientConnectionManager build() { tlsStrategyCopy = tlsStrategy; } else { if (ReflectionUtils.determineJRELevel() <= 8 && ConscryptClientTlsStrategy.isSupported()) { - if (systemProperties) { - tlsStrategyCopy = ConscryptClientTlsStrategy.getSystemDefault(); + if (!ignoreSystemProperties) { + tlsStrategyCopy = ConscryptClientTlsStrategy.create(); } else { - tlsStrategyCopy = ConscryptClientTlsStrategy.getDefault(); + tlsStrategyCopy = new ConscryptClientTlsStrategy(SSLContexts.createDefault(), HostnameVerificationPolicy.BUILTIN, null); } } else { - if (systemProperties) { - tlsStrategyCopy = DefaultClientTlsStrategy.createSystemDefault(); + if (!ignoreSystemProperties) { + tlsStrategyCopy = DefaultClientTlsStrategy.create(); } else { - tlsStrategyCopy = DefaultClientTlsStrategy.createDefault(); + tlsStrategyCopy = new DefaultClientTlsStrategy(SSLContexts.createDefault(), HostnameVerificationPolicy.BUILTIN, null); } } } diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/ClientTlsStrategyBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/ClientTlsStrategyBuilder.java index 3f54b8e570..5beb33f4d4 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/ClientTlsStrategyBuilder.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/ClientTlsStrategyBuilder.java @@ -42,10 +42,8 @@ * Builder for client TLS strategy instances. *

      * When a particular component is not explicitly set this class will - * use its default implementation. System properties will be taken - * into account when configuring the default implementations when - * {@link #useSystemProperties()} method is called prior to calling - * {@link #buildAsync()} or {@link #buildClassic()}. + * use its default implementation. The following system are taken into + * account. *

      *
        *
      • ssl.TrustManagerFactory.algorithm
      • @@ -76,7 +74,7 @@ public static ClientTlsStrategyBuilder create() { private SSLBufferMode sslBufferMode; private HostnameVerificationPolicy hostnameVerificationPolicy; private HostnameVerifier hostnameVerifier; - private boolean systemProperties; + private boolean ignoreSystemProperties; /** * Sets {@link SSLContext} instance. @@ -179,7 +177,20 @@ public ClientTlsStrategyBuilder setTlsDetailsFactory(final Factory { // Send MD5 hash in a trailer by decorating the original entity producer diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientSNI.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientSNI.java index 9b38baa82c..8f87258ae7 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientSNI.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientSNI.java @@ -51,7 +51,7 @@ public class AsyncClientSNI { public static void main(final String[] args) throws Exception { - try (final CloseableHttpAsyncClient client = HttpAsyncClients.createSystem()) { + try (final CloseableHttpAsyncClient client = HttpAsyncClients.create()) { client.start(); diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientServerBrotliRoundTrip.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientServerBrotliRoundTrip.java index 74f522f78b..9fb25b4c20 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientServerBrotliRoundTrip.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientServerBrotliRoundTrip.java @@ -93,7 +93,7 @@ public static void main(final String[] args) throws Exception { final int port = server.getLocalPort(); final String url = "http://localhost:" + port + "/echo"; - try (final CloseableHttpAsyncClient client = HttpAsyncClients.createDefault()) { + try (final CloseableHttpAsyncClient client = HttpAsyncClients.create()) { client.start(); final String requestBody = "Hello Brotli world (round-trip)!"; diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientServerZstdExample.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientServerZstdExample.java index 3eb4894ed9..00424ca05c 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientServerZstdExample.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientServerZstdExample.java @@ -108,7 +108,7 @@ public static void main(final String[] args) throws Exception { final int port = server.getLocalPort(); final String url = "http://localhost:" + port + "/echo"; - try (final CloseableHttpAsyncClient client = HttpAsyncClients.createDefault()) { + try (final CloseableHttpAsyncClient client = HttpAsyncClients.create()) { client.start(); final String requestBody = "Hello Zstandard world!"; diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientZstdCompressionExample.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientZstdCompressionExample.java index 5da9d741f9..ac44f83de4 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientZstdCompressionExample.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientZstdCompressionExample.java @@ -121,7 +121,7 @@ public static void main(final String[] args) throws Exception { final int port = server.getLocalPort(); final String url = "http://localhost:" + port + "/echo"; - try (CloseableHttpAsyncClient client = HttpAsyncClients.createDefault()) { + try (CloseableHttpAsyncClient client = HttpAsyncClients.create()) { client.start(); final String payload = "Hello Zstandard request body!"; diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncPreemptiveBasicClientAuthentication.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncPreemptiveBasicClientAuthentication.java index 4670b2f585..c08717d977 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncPreemptiveBasicClientAuthentication.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncPreemptiveBasicClientAuthentication.java @@ -50,7 +50,7 @@ public class AsyncPreemptiveBasicClientAuthentication { public static void main(final String[] args) throws Exception { - final CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault(); + final CloseableHttpAsyncClient httpclient = HttpAsyncClients.create(); httpclient.start(); final HttpClientContext localContext = ContextBuilder.create() diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientAbortMethod.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientAbortMethod.java index 1c01d8420c..afd0a9d4f9 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientAbortMethod.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientAbortMethod.java @@ -44,7 +44,7 @@ public class ClientAbortMethod { public static void main(final String[] args) throws Exception { - try (final CloseableHttpClient httpclient = HttpClients.createDefault()) { + try (final CloseableHttpClient httpclient = HttpClients.create()) { final HttpGet httpget = new HttpGet("http://httpbin.org/get"); final ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1, diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientAuthentication.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientAuthentication.java index 0ed268371c..38b3a2fd95 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientAuthentication.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientAuthentication.java @@ -41,7 +41,7 @@ public class ClientAuthentication { public static void main(final String[] args) throws Exception { - try (final CloseableHttpClient httpclient = HttpClients.custom() + try (final CloseableHttpClient httpclient = HttpClients.builder() .setDefaultCredentialsProvider(CredentialsProviderBuilder.create() .add(new HttpHost("httpbin.org", 80), "user", "passwd".toCharArray()) .build()) diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientChunkEncodedPost.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientChunkEncodedPost.java index 64504fd5a2..28b3e5f1ef 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientChunkEncodedPost.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientChunkEncodedPost.java @@ -47,7 +47,7 @@ public static void main(final String[] args) throws Exception { System.out.println("File path not given"); System.exit(1); } - try (final CloseableHttpClient httpclient = HttpClients.createDefault()) { + try (final CloseableHttpClient httpclient = HttpClients.create()) { final HttpPost httppost = new HttpPost("http://httpbin.org/post"); final File file = new File(args[0]); diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientClassicOverAsync.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientClassicOverAsync.java index dd6d61c23f..94282d79e9 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientClassicOverAsync.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientClassicOverAsync.java @@ -52,7 +52,7 @@ public class ClientClassicOverAsync { public static void main(final String[] args) throws Exception { try (final CloseableHttpClient httpclient = HttpAsyncClients.classic( - HttpAsyncClients.createDefault(), + HttpAsyncClients.create(), Timeout.ofMinutes(1))) { final HttpGet httpget = new HttpGet("http://httpbin.org/get"); System.out.println("Executing request " + httpget.getMethod() + " " + httpget.getUri()); diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientConfiguration.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientConfiguration.java index a9acf0098d..b8baae9007 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientConfiguration.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientConfiguration.java @@ -215,7 +215,7 @@ public InetAddress[] resolve(final String host) throws UnknownHostException { // Create an HttpClient with the given custom dependencies and configuration. - try (final CloseableHttpClient httpclient = HttpClients.custom() + try (final CloseableHttpClient httpclient = HttpClients.builder() .setConnectionManager(connManager) .setDefaultCookieStore(cookieStore) .setDefaultCredentialsProvider(credentialsProvider) diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientConnectionConfig.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientConnectionConfig.java index 0f9dcd35b1..e7fe5e1804 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientConnectionConfig.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientConnectionConfig.java @@ -78,7 +78,7 @@ public final static void main(final String[] args) throws Exception { return TlsConfig.DEFAULT; }) .build(); - try (CloseableHttpClient httpclient = HttpClients.custom() + try (CloseableHttpClient httpclient = HttpClients.builder() .setConnectionManager(cm) .build()) { diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientConnectionRelease.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientConnectionRelease.java index a78e5a76d5..87563b7d1e 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientConnectionRelease.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientConnectionRelease.java @@ -42,7 +42,7 @@ public class ClientConnectionRelease { public static void main(final String[] args) throws Exception { - try (final CloseableHttpClient httpclient = HttpClients.createDefault()) { + try (final CloseableHttpClient httpclient = HttpClients.create()) { final HttpHost target = new HttpHost("http", "httpbin.org"); final HttpGet httpget = new HttpGet("/get"); diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientCustomContext.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientCustomContext.java index dff8586317..6ab853aea0 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientCustomContext.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientCustomContext.java @@ -47,7 +47,7 @@ public class ClientCustomContext { public static void main(final String[] args) throws Exception { - try (final CloseableHttpClient httpclient = HttpClients.createDefault()) { + try (final CloseableHttpClient httpclient = HttpClients.create()) { // Create a local instance of cookie store final CookieStore cookieStore = new BasicCookieStore(); diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientCustomPublicSuffixList.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientCustomPublicSuffixList.java index 3007490f67..face386c29 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientCustomPublicSuffixList.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientCustomPublicSuffixList.java @@ -73,7 +73,7 @@ public static void main(final String[] args) throws Exception { final HttpClientConnectionManager cm = PoolingHttpClientConnectionManagerBuilder.create() .setTlsSocketStrategy(tlsStrategy) .build(); - try (final CloseableHttpClient httpclient = HttpClients.custom() + try (final CloseableHttpClient httpclient = HttpClients.builder() .setConnectionManager(cm) .setDefaultCookieSpecRegistry(cookieSpecRegistry) .build()) { diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientCustomSSL.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientCustomSSL.java index 5983524d1b..65c91f5127 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientCustomSSL.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientCustomSSL.java @@ -76,7 +76,7 @@ public final static void main(final String[] args) throws Exception { .setSupportedProtocols(TLS.V_1_3) .build()) .build(); - try (CloseableHttpClient httpclient = HttpClients.custom() + try (CloseableHttpClient httpclient = HttpClients.builder() .setConnectionManager(cm) .build()) { diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientEvictExpiredConnections.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientEvictExpiredConnections.java index 847ceeba47..c664f5eba7 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientEvictExpiredConnections.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientEvictExpiredConnections.java @@ -44,7 +44,7 @@ public class ClientEvictExpiredConnections { public static void main(final String[] args) throws Exception { final PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); cm.setMaxTotal(100); - try (final CloseableHttpClient httpclient = HttpClients.custom() + try (final CloseableHttpClient httpclient = HttpClients.builder() .setConnectionManager(cm) .evictExpiredConnections() .evictIdleConnections(TimeValue.ofSeconds(5)) diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientExecuteProxy.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientExecuteProxy.java index c56915500c..a952bbc59c 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientExecuteProxy.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientExecuteProxy.java @@ -45,7 +45,7 @@ public class ClientExecuteProxy { public static void main(final String[] args)throws Exception { final HttpHost target = new HttpHost("https", "httpbin.org", 443); final HttpHost proxy = new HttpHost("http", "127.0.0.1", 8080); - try (final CloseableHttpClient httpclient = HttpClients.custom() + try (final CloseableHttpClient httpclient = HttpClients.builder() .setProxy(proxy) .build()) { diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientExecuteSOCKS.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientExecuteSOCKS.java index 4e0d107b15..4183ebf06b 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientExecuteSOCKS.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientExecuteSOCKS.java @@ -53,7 +53,7 @@ public static void main(final String[] args)throws Exception { .setSocksProxyAddress(socksaddr) .build()) .build(); - try (final CloseableHttpClient httpclient = HttpClients.custom() + try (final CloseableHttpClient httpclient = HttpClients.builder() .setConnectionManager(cm) .build()) { diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientFormLogin.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientFormLogin.java index e13d018296..8d7610402e 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientFormLogin.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientFormLogin.java @@ -46,7 +46,7 @@ public class ClientFormLogin { public static void main(final String[] args) throws Exception { final BasicCookieStore cookieStore = new BasicCookieStore(); - try (final CloseableHttpClient httpclient = HttpClients.custom() + try (final CloseableHttpClient httpclient = HttpClients.builder() .setDefaultCookieStore(cookieStore) .build()) { final HttpGet httpget = new HttpGet("https://someportal/"); diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientInterceptors.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientInterceptors.java index 0e4046942e..f281801c22 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientInterceptors.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientInterceptors.java @@ -53,7 +53,7 @@ public class ClientInterceptors { public static void main(final String[] args) throws Exception { - try (final CloseableHttpClient httpclient = HttpClients.custom() + try (final CloseableHttpClient httpclient = HttpClients.builder() // Add a simple request ID to each outgoing request diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientMultiThreadedExecution.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientMultiThreadedExecution.java index 411f7d959c..b6f7b2bb21 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientMultiThreadedExecution.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientMultiThreadedExecution.java @@ -48,7 +48,7 @@ public static void main(final String[] args) throws Exception { final PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); cm.setMaxTotal(100); - try (final CloseableHttpClient httpclient = HttpClients.custom() + try (final CloseableHttpClient httpclient = HttpClients.builder() .setConnectionManager(cm) .build()) { // create an array of URIs to perform GETs on diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientMultipartFormPost.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientMultipartFormPost.java index c819068156..3b0d811065 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientMultipartFormPost.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientMultipartFormPost.java @@ -48,7 +48,7 @@ public static void main(final String[] args) throws Exception { System.out.println("File path not given"); System.exit(1); } - try (final CloseableHttpClient httpclient = HttpClients.createDefault()) { + try (final CloseableHttpClient httpclient = HttpClients.create()) { final HttpPost httppost = new HttpPost("http://httpbin.org/post"); final FileBody bin = new FileBody(new File(args[0])); diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientPreemptiveBasicAuthentication.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientPreemptiveBasicAuthentication.java index 6f4a864da8..a851dd0d43 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientPreemptiveBasicAuthentication.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientPreemptiveBasicAuthentication.java @@ -47,7 +47,7 @@ public class ClientPreemptiveBasicAuthentication { public static void main(final String[] args) throws Exception { - try (final CloseableHttpClient httpclient = HttpClients.createDefault()) { + try (final CloseableHttpClient httpclient = HttpClients.create()) { final HttpClientContext localContext = ContextBuilder.create() .preemptiveBasicAuth(new HttpHost("http", "httpbin.org"), diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientPreemptiveDigestAuthentication.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientPreemptiveDigestAuthentication.java index f056fb60e2..23d5a2b750 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientPreemptiveDigestAuthentication.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientPreemptiveDigestAuthentication.java @@ -49,7 +49,7 @@ public class ClientPreemptiveDigestAuthentication { public static void main(final String[] args) throws Exception { - try (final CloseableHttpClient httpclient = HttpClients.createDefault()) { + try (final CloseableHttpClient httpclient = HttpClients.create()) { final HttpHost target = new HttpHost("http", "httpbin.org", 80); diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientProxyAuthentication.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientProxyAuthentication.java index fde839c7e8..613a0a395a 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientProxyAuthentication.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientProxyAuthentication.java @@ -50,7 +50,7 @@ public static void main(final String[] args) throws Exception { .build(); final HttpHost target = new HttpHost("http", "httpbin.org", 80); final HttpHost proxy = new HttpHost("localhost", 8888); - try (final CloseableHttpClient httpclient = HttpClients.custom() + try (final CloseableHttpClient httpclient = HttpClients.builder() .setProxy(proxy) .setDefaultCredentialsProvider(credsProvider) .build()) { diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientRemoteEndpointDetails.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientRemoteEndpointDetails.java index 15e5cb96f9..05855cc2a2 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientRemoteEndpointDetails.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientRemoteEndpointDetails.java @@ -42,7 +42,7 @@ public class ClientRemoteEndpointDetails { public static void main(final String[] args) throws Exception { - try (final CloseableHttpClient httpclient = HttpClients.createDefault()) { + try (final CloseableHttpClient httpclient = HttpClients.create()) { // Create local HTTP context final HttpClientContext localContext = HttpClientContext.create(); diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientResponseProcessing.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientResponseProcessing.java index ad7c45542f..cf78c1ba4a 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientResponseProcessing.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientResponseProcessing.java @@ -40,7 +40,7 @@ public class ClientResponseProcessing { public static void main(final String[] args) throws Exception { - try (final CloseableHttpClient httpclient = HttpClients.createDefault()) { + try (final CloseableHttpClient httpclient = HttpClients.create()) { final HttpGet httpget = new HttpGet("http://httpbin.org/get"); System.out.println("Executing request " + httpget.getMethod() + " " + httpget.getUri()); diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientSNI.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientSNI.java index 17736e884e..780577c131 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientSNI.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientSNI.java @@ -44,7 +44,7 @@ public class ClientSNI { public final static void main(final String[] args) throws Exception { - try (CloseableHttpClient httpclient = HttpClients.createSystem()) { + try (CloseableHttpClient httpclient = HttpClients.create()) { final HttpHost target = new HttpHost("https", "www.google.com"); final HttpGet httpget = new HttpGet("https://www.google.ch/"); diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientServerCompressionExample.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientServerCompressionExample.java index 4656cf88da..bf397a94a6 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientServerCompressionExample.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientServerCompressionExample.java @@ -95,7 +95,7 @@ public static void main(final String[] args) throws Exception { server.start(); final int actualPort = server.getLocalPort(); - try (CloseableHttpClient client = HttpClients.createDefault()) { + try (CloseableHttpClient client = HttpClients.create()) { final String requestBody = "Hello Zstandard world!"; System.out.println("Request : " + requestBody); diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientSpkiPinningExample.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientSpkiPinningExample.java index a05c4b2367..bdbe7e9764 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientSpkiPinningExample.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientSpkiPinningExample.java @@ -65,7 +65,7 @@ public static void main(final String[] args) throws Exception { .setTlsSocketStrategy(pinning) // classic path .build(); - try (final CloseableHttpClient httpclient = HttpClients.custom() + try (final CloseableHttpClient httpclient = HttpClients.builder() .setConnectionManager(cm) .build()) { diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ReactiveClientFullDuplexExchange.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ReactiveClientFullDuplexExchange.java index f6b7f5b7ee..a502f5573b 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ReactiveClientFullDuplexExchange.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ReactiveClientFullDuplexExchange.java @@ -32,8 +32,11 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; +import io.reactivex.rxjava3.core.Flowable; +import io.reactivex.rxjava3.core.Observable; import org.apache.hc.client5.http.impl.async.HttpAsyncClients; import org.apache.hc.client5.http.impl.async.MinimalHttpAsyncClient; +import org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManagerBuilder; import org.apache.hc.core5.http.ContentType; import org.apache.hc.core5.http.Header; import org.apache.hc.core5.http.HttpResponse; @@ -47,9 +50,6 @@ import org.apache.hc.core5.reactor.IOReactorConfig; import org.reactivestreams.Publisher; -import io.reactivex.rxjava3.core.Flowable; -import io.reactivex.rxjava3.core.Observable; - /** * This example demonstrates a reactive, full-duplex HTTP/1.1 message exchange using RxJava. */ @@ -60,7 +60,8 @@ public static void main(final String[] args) throws Exception { final MinimalHttpAsyncClient client = HttpAsyncClients.createMinimal( H2Config.DEFAULT, Http1Config.DEFAULT, - IOReactorConfig.DEFAULT); + IOReactorConfig.DEFAULT, + PoolingAsyncClientConnectionManagerBuilder.create().build()); client.start(); diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/async/EarlyHintsAsyncExecTest.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/async/EarlyHintsAsyncExecTest.java index 85a6ad1104..9f92593428 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/async/EarlyHintsAsyncExecTest.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/async/EarlyHintsAsyncExecTest.java @@ -176,7 +176,7 @@ public void releaseResources() { /* no-op for test */ } } }; - try (final CloseableHttpAsyncClient client = HttpAsyncClients.custom() + try (final CloseableHttpAsyncClient client = HttpAsyncClients.builder() .setEarlyHintsListener(listener) .build()) { diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestHttpAsyncClientBuilder.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestHttpAsyncClientBuilder.java index ac15ce15d6..a6140c749a 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestHttpAsyncClientBuilder.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestHttpAsyncClientBuilder.java @@ -41,7 +41,7 @@ class TestHttpAsyncClientBuilder { @Test void testAddInterceptorFirstDoesNotThrow() throws IOException { - HttpAsyncClients.custom() + HttpAsyncClients.builder() .addExecInterceptorFirst("first", NopExecChainHandler.INSTANCE) .build() .close(); @@ -49,7 +49,7 @@ void testAddInterceptorFirstDoesNotThrow() throws IOException { @Test void testAddInterceptorLastDoesNotThrow() throws IOException { - HttpAsyncClients.custom() + HttpAsyncClients.builder() .addExecInterceptorLast("last", NopExecChainHandler.INSTANCE) .build() .close(); @@ -57,7 +57,7 @@ void testAddInterceptorLastDoesNotThrow() throws IOException { @Test void testH2AddInterceptorFirstDoesNotThrow() throws IOException { - HttpAsyncClients.customHttp2() + HttpAsyncClients.http2Builder() .addExecInterceptorFirst("first", NopExecChainHandler.INSTANCE) .build() .close(); @@ -65,7 +65,7 @@ void testH2AddInterceptorFirstDoesNotThrow() throws IOException { @Test void testH2AddInterceptorLastDoesNotThrow() throws IOException { - HttpAsyncClients.customHttp2() + HttpAsyncClients.http2Builder() .addExecInterceptorLast("last", NopExecChainHandler.INSTANCE) .build() .close(); diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestHttpClientBuilder.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestHttpClientBuilder.java index 2cec4699e2..955362b715 100644 --- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestHttpClientBuilder.java +++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestHttpClientBuilder.java @@ -40,7 +40,7 @@ class TestHttpClientBuilder { @Test void testAddInterceptorFirstDoesNotThrow() throws IOException { // HTTPCLIENT-2083 - HttpClients.custom() + HttpClients.builder() .addExecInterceptorFirst("first", NopExecChainHandler.INSTANCE) .build() .close(); @@ -49,7 +49,7 @@ void testAddInterceptorFirstDoesNotThrow() throws IOException { @Test void testAddInterceptorLastDoesNotThrow() throws IOException { // HTTPCLIENT-2083 - HttpClients.custom() + HttpClients.builder() .addExecInterceptorLast("last", NopExecChainHandler.INSTANCE) .build() .close();