Re-use core URIScheme instead of String.
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/SystemDefaultCredentialsProvider.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/SystemDefaultCredentialsProvider.java
index 7e7e201..99add9f 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/SystemDefaultCredentialsProvider.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/SystemDefaultCredentialsProvider.java
@@ -118,9 +118,9 @@
// https.proxyUser/https.proxyPassword. We cannot simply use the protocol from
// the origin since a proxy retrieved from https.proxyHost/https.proxyPort will
// still use http as protocol
- systemcreds = getProxyCredentials("http", authScope);
+ systemcreds = getProxyCredentials(URIScheme.HTTP.getId(), authScope);
if (systemcreds == null) {
- systemcreds = getProxyCredentials("https", authScope);
+ systemcreds = getProxyCredentials(URIScheme.HTTPS.getId(), authScope);
}
}
if (systemcreds != 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 d507154..3db4ca1 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
@@ -60,6 +60,7 @@
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpVersion;
import org.apache.hc.core5.http.ProtocolVersion;
+import org.apache.hc.core5.http.URIScheme;
import org.apache.hc.core5.http.config.Lookup;
import org.apache.hc.core5.http.config.RegistryBuilder;
import org.apache.hc.core5.http.nio.AsyncClientExchangeHandler;
@@ -128,7 +129,7 @@
public PoolingAsyncClientConnectionManager() {
this(RegistryBuilder.<TlsStrategy>create()
- .register("https", DefaultClientTlsStrategy.getDefault())
+ .register(URIScheme.HTTPS.getId(), DefaultClientTlsStrategy.getDefault())
.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 122e000..941f412 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
@@ -36,6 +36,7 @@
import org.apache.hc.client5.http.ssl.DefaultClientTlsStrategy;
import org.apache.hc.core5.function.Resolver;
import org.apache.hc.core5.http.HttpHost;
+import org.apache.hc.core5.http.URIScheme;
import org.apache.hc.core5.http.config.RegistryBuilder;
import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.nio.ssl.TlsStrategy;
@@ -247,7 +248,7 @@
}
final PoolingAsyncClientConnectionManager poolingmgr = new PoolingAsyncClientConnectionManager(
RegistryBuilder.<TlsStrategy>create()
- .register("https", tlsStrategyCopy)
+ .register(URIScheme.HTTPS.getId(), tlsStrategyCopy)
.build(),
poolConcurrencyPolicy,
poolReusePolicy,
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/routing/DefaultRoutePlanner.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/routing/DefaultRoutePlanner.java
index f8b4621..fac55af 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/routing/DefaultRoutePlanner.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/routing/DefaultRoutePlanner.java
@@ -41,6 +41,7 @@
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.ProtocolException;
+import org.apache.hc.core5.http.URIScheme;
import org.apache.hc.core5.http.protocol.HttpContext;
/**
@@ -75,7 +76,7 @@
if (target.getPort() < 0) {
throw new ProtocolException("Unroutable protocol scheme: " + target);
}
- final boolean secure = target.getSchemeName().equalsIgnoreCase("https");
+ final boolean secure = target.getSchemeName().equalsIgnoreCase(URIScheme.HTTPS.getId());
if (proxy == null) {
return new HttpRoute(target, determineLocalAddress(target, context), secure);
}