You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2018/12/04 14:56:19 UTC
[2/4] httpcomponents-client git commit: Upgraded HttpCore to version
5.0-beta6
Upgraded HttpCore to version 5.0-beta6
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/commit/b4520067
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/tree/b4520067
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/diff/b4520067
Branch: refs/heads/master
Commit: b4520067565cc5c484ebae126311bbf060eb3527
Parents: 4ee9d31
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Tue Dec 4 15:49:56 2018 +0100
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Tue Dec 4 15:49:56 2018 +0100
----------------------------------------------------------------------
.../hc/client5/http/cache/HttpCacheEntry.java | 27 ------------------
.../http/impl/cache/AsyncCachingExec.java | 16 +++++------
.../hc/client5/http/impl/cache/CachingExec.java | 2 +-
.../ExponentialBackOffSchedulingStrategy.java | 2 +-
.../http/impl/cache/TestCacheKeyGenerator.java | 30 ++++++++++----------
...ExponentialBackingOffSchedulingStrategy.java | 16 +++++------
.../client5/testing/async/AsyncEchoHandler.java | 4 +--
.../testing/async/AsyncRandomHandler.java | 3 +-
.../async/AuthenticatingAsyncDecorator.java | 6 ++--
.../async/AbstractHttp1IntegrationTestBase.java | 2 +-
.../async/AbstractHttpAsyncRedirectsTest.java | 22 +++++++-------
.../async/AbstractIntegrationTestBase.java | 4 +--
.../testing/async/TestHttp1AsyncRedirects.java | 2 +-
.../TestHttp1AsyncStatefulConnManagement.java | 2 +-
...CachingHttpAsyncClientCompatibilityTest.java | 4 +--
.../CachingHttpClientCompatibilityTest.java | 2 +-
.../HttpAsyncClientCompatibilityTest.java | 16 +++++------
.../external/HttpClientCompatibilityTest.java | 12 ++++----
.../testing/sync/LocalServerTestBase.java | 2 +-
.../testing/sync/TestConnectionManagement.java | 14 ++++-----
.../sync/TestIdleConnectionEviction.java | 2 +-
.../testing/sync/TestSSLSocketFactory.java | 16 +++++------
.../http/examples/AsyncClientCustomSSL.java | 2 +-
.../examples/AsyncClientFullDuplexExchange.java | 4 +--
.../AsyncClientHttp2FullDuplexExchange.java | 4 +--
.../examples/AsyncClientHttp2ServerPush.java | 10 -------
.../AsyncClientHttpExchangeStreaming.java | 5 ----
.../http/examples/AsyncClientTlsAlpn.java | 2 +-
.../client5/http/examples/AsyncQuickStart.java | 5 ----
.../http/examples/ClientExecuteProxy.java | 4 +--
.../http/examples/ClientExecuteSOCKS.java | 2 +-
.../ClientPreemptiveBasicAuthentication.java | 2 +-
.../ClientPreemptiveDigestAuthentication.java | 2 +-
.../examples/ClientProxyAuthentication.java | 2 +-
.../ReactiveClientFullDuplexExchange.java | 23 ++++++++-------
.../hc/client5/http/impl/AuthSupport.java | 8 +++---
.../impl/async/Http2AsyncMainClientExec.java | 6 ++--
.../impl/async/HttpAsyncMainClientExec.java | 6 ++--
.../LoggingAsyncClientExchangeHandler.java | 4 +--
.../http/impl/async/LoggingIOSession.java | 5 ++++
.../impl/async/MinimalHttp2AsyncClient.java | 6 ++--
.../http/impl/async/MinimalHttpAsyncClient.java | 6 ++--
.../impl/classic/CloseableHttpResponse.java | 27 ------------------
.../client5/http/impl/classic/ProxyClient.java | 2 +-
.../io/DefaultManagedHttpClientConnection.java | 4 +--
.../impl/routing/SystemDefaultRoutePlanner.java | 2 +-
.../client5/http/protocol/RequestAuthCache.java | 4 +--
.../hc/client5/http/routing/RoutingSupport.java | 4 +--
.../apache/hc/client5/http/utils/URIUtils.java | 2 +-
.../hc/client5/http/auth/TestAuthScope.java | 4 +--
.../client5/http/config/TestRequestConfig.java | 4 +--
.../http/impl/TestIdleConnectionEvictor.java | 4 +--
.../impl/classic/TestCloseableHttpClient.java | 16 +++++------
.../impl/classic/TestInternalExecRuntime.java | 10 +++----
.../http/impl/classic/TestMainClientExec.java | 6 ++--
.../TestBasicHttpClientConnectionManager.java | 26 ++++++++---------
.../io/TestHttpClientConnectionOperator.java | 22 +++++++-------
.../TestPoolingHttpClientConnectionManager.java | 12 ++++----
.../routing/TestDefaultProxyRoutePlanner.java | 4 +--
.../impl/routing/TestDefaultRoutePlanner.java | 8 +++---
.../http/impl/routing/TestRoutingSupport.java | 2 +-
.../routing/TestSystemDefaultRoutePlanner.java | 8 +++---
.../http/protocol/TestRequestAddCookies.java | 6 ++--
.../protocol/TestRequestClientConnControl.java | 10 +++----
.../hc/client5/http/utils/TestURIUtils.java | 10 +++----
pom.xml | 2 +-
66 files changed, 218 insertions(+), 295 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-cache/src/main/java/org/apache/hc/client5/http/cache/HttpCacheEntry.java
----------------------------------------------------------------------
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/cache/HttpCacheEntry.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/cache/HttpCacheEntry.java
index ae00f77..47ed671 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/cache/HttpCacheEntry.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/cache/HttpCacheEntry.java
@@ -175,15 +175,6 @@ public class HttpCacheEntry implements MessageHeaders, Serializable {
}
/**
- * @deprecated use {@link #getHeaders()}
- */
- @Override
- @Deprecated
- public Header[] getAllHeaders() {
- return getHeaders();
- }
-
- /**
* Returns the first header from the origin response with the given
* name.
*/
@@ -232,15 +223,6 @@ public class HttpCacheEntry implements MessageHeaders, Serializable {
}
/**
- * @deprecated use {@link #countHeaders(String)}
- */
- @Override
- @Deprecated
- public int containsHeaders(final String name) {
- return countHeaders(name);
- }
-
- /**
* @since 5.0
*/
@Override
@@ -249,15 +231,6 @@ public class HttpCacheEntry implements MessageHeaders, Serializable {
}
/**
- * @deprecated use {@link #getHeader(String)}
- */
- @Override
- @Deprecated
- public Header getSingleHeader(final String name) throws ProtocolException {
- return getHeader(name);
- }
-
- /**
* @since 5.0
*/
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/AsyncCachingExec.java
----------------------------------------------------------------------
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/AsyncCachingExec.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/AsyncCachingExec.java
index beecb4d..2d0b69e 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/AsyncCachingExec.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/AsyncCachingExec.java
@@ -210,7 +210,7 @@ class AsyncCachingExec extends CachingExecBase implements AsyncExecChainHandler
final URIAuthority authority = request.getAuthority();
final String scheme = request.getScheme();
- final HttpHost target = authority != null ? new HttpHost(authority, scheme) : route.getTargetHost();
+ final HttpHost target = authority != null ? new HttpHost(scheme, authority) : route.getTargetHost();
final String via = generateViaHeader(request);
// default response context
@@ -371,7 +371,7 @@ class AsyncCachingExec extends CachingExecBase implements AsyncExecChainHandler
}
@Override
- public final int consume(final ByteBuffer src) throws IOException {
+ public final void consume(final ByteBuffer src) throws IOException {
final ByteArrayBuffer buffer = bufferRef.get();
if (buffer != null) {
if (src.hasArray()) {
@@ -391,19 +391,17 @@ class AsyncCachingExec extends CachingExecBase implements AsyncExecChainHandler
if (dataConsumer != null) {
dataConsumerRef.set(dataConsumer);
writtenThrough.set(true);
- return dataConsumer.consume(ByteBuffer.wrap(buffer.array(), 0, buffer.length()));
+ dataConsumer.consume(ByteBuffer.wrap(buffer.array(), 0, buffer.length()));
}
} catch (final HttpException ex) {
fallback.failed(ex);
}
}
- return Integer.MAX_VALUE;
- }
- final AsyncDataConsumer dataConsumer = dataConsumerRef.get();
- if (dataConsumer != null) {
- return dataConsumer.consume(src);
} else {
- return Integer.MAX_VALUE;
+ final AsyncDataConsumer dataConsumer = dataConsumerRef.get();
+ if (dataConsumer != null) {
+ dataConsumer.consume(src);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java
----------------------------------------------------------------------
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java
index 10a0f8d..cd5725a 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingExec.java
@@ -166,7 +166,7 @@ class CachingExec extends CachingExecBase implements ExecChainHandler {
final URIAuthority authority = request.getAuthority();
final String scheme = request.getScheme();
- final HttpHost target = authority != null ? new HttpHost(authority, scheme) : route.getTargetHost();
+ final HttpHost target = authority != null ? new HttpHost(scheme, authority) : route.getTargetHost();
final String via = generateViaHeader(request);
// default response context
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/schedule/ExponentialBackOffSchedulingStrategy.java
----------------------------------------------------------------------
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/schedule/ExponentialBackOffSchedulingStrategy.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/schedule/ExponentialBackOffSchedulingStrategy.java
index 92e5509..b00b188 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/schedule/ExponentialBackOffSchedulingStrategy.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/schedule/ExponentialBackOffSchedulingStrategy.java
@@ -91,7 +91,7 @@ public class ExponentialBackOffSchedulingStrategy implements SchedulingStrategy
@Override
public TimeValue schedule(final int attemptNumber) {
- return TimeValue.ofMillis(calculateDelayInMillis(attemptNumber));
+ return TimeValue.ofMilliseconds(calculateDelayInMillis(attemptNumber));
}
public long getBackOffRate() {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheKeyGenerator.java
----------------------------------------------------------------------
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheKeyGenerator.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheKeyGenerator.java
index e1b9256..ef409c2 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheKeyGenerator.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheKeyGenerator.java
@@ -80,11 +80,11 @@ public class TestCacheKeyGenerator {
@Test
public void testGetURIWithDifferentScheme() {
- Assert.assertEquals("https://www.comcast.net:443/", extractor.generateKey(new HttpHost(
- "www.comcast.net", -1, "https"), REQUEST_ROOT));
+ Assert.assertEquals("https://www.comcast.net:443/", extractor.generateKey(
+ new HttpHost("https", "www.comcast.net", -1), REQUEST_ROOT));
Assert.assertEquals("myhttp://www.fancast.com/full_episodes", extractor.generateKey(
- new HttpHost("www.fancast.com", -1, "myhttp"), REQUEST_FULL_EPISODES));
+ new HttpHost("myhttp", "www.fancast.com", -1), REQUEST_FULL_EPISODES));
}
@Test
@@ -98,19 +98,19 @@ public class TestCacheKeyGenerator {
@Test
public void testGetURIWithDifferentPortAndScheme() {
- Assert.assertEquals("https://www.comcast.net:8080/", extractor.generateKey(new HttpHost(
- "www.comcast.net", 8080, "https"), REQUEST_ROOT));
+ Assert.assertEquals("https://www.comcast.net:8080/", extractor.generateKey(
+ new HttpHost("https", "www.comcast.net", 8080), REQUEST_ROOT));
Assert.assertEquals("myhttp://www.fancast.com:9999/full_episodes", extractor.generateKey(
- new HttpHost("www.fancast.com", 9999, "myhttp"), REQUEST_FULL_EPISODES));
+ new HttpHost("myhttp", "www.fancast.com", 9999), REQUEST_FULL_EPISODES));
}
@Test
public void testGetURIWithQueryParameters() {
- Assert.assertEquals("http://www.comcast.net:80/?foo=bar", extractor.generateKey(new HttpHost(
- "www.comcast.net", -1, "http"), new BasicHttpRequest("GET", "/?foo=bar")));
+ Assert.assertEquals("http://www.comcast.net:80/?foo=bar", extractor.generateKey(
+ new HttpHost("http", "www.comcast.net", -1), new BasicHttpRequest("GET", "/?foo=bar")));
Assert.assertEquals("http://www.fancast.com:80/full_episodes?foo=bar", extractor.generateKey(
- new HttpHost("www.fancast.com", -1, "http"), new BasicHttpRequest("GET",
+ new HttpHost("http", "www.fancast.com", -1), new BasicHttpRequest("GET",
"/full_episodes?foo=bar")));
}
@@ -294,8 +294,8 @@ public class TestCacheKeyGenerator {
@Test
public void testEmptyPortEquivalentToDefaultPortForHttps() {
- final HttpHost host1 = new HttpHost("foo.example.com", -1, "https");
- final HttpHost host2 = new HttpHost("foo.example.com", 443, "https");
+ final HttpHost host1 = new HttpHost("https", "foo.example.com", -1);
+ final HttpHost host2 = new HttpHost("https", "foo.example.com", 443);
final HttpRequest req = new BasicHttpRequest("GET", "/");
final String uri1 = extractor.generateKey(host1, req);
final String uri2 = extractor.generateKey(host2, req);
@@ -304,7 +304,7 @@ public class TestCacheKeyGenerator {
@Test
public void testEmptyPortEquivalentToDefaultPortForHttpsAbsoluteURI() {
- final HttpHost host = new HttpHost("foo.example.com", -1, "https");
+ final HttpHost host = new HttpHost("https", "foo.example.com", -1);
final HttpGet get1 = new HttpGet("https://bar.example.com:/");
final HttpGet get2 = new HttpGet("https://bar.example.com:443/");
final String uri1 = extractor.generateKey(host, get1);
@@ -314,7 +314,7 @@ public class TestCacheKeyGenerator {
@Test
public void testNotProvidedPortEquivalentToDefaultPortForHttpsAbsoluteURI() {
- final HttpHost host = new HttpHost("foo.example.com", -1, "https");
+ final HttpHost host = new HttpHost("https", "foo.example.com", -1);
final HttpGet get1 = new HttpGet("https://bar.example.com/");
final HttpGet get2 = new HttpGet("https://bar.example.com:443/");
final String uri1 = extractor.generateKey(host, get1);
@@ -340,8 +340,8 @@ public class TestCacheKeyGenerator {
@Test
public void testSchemeNameComparisonsAreCaseInsensitive() {
- final HttpHost host1 = new HttpHost("foo.example.com", -1, "http");
- final HttpHost host2 = new HttpHost("foo.example.com", -1, "HTTP");
+ final HttpHost host1 = new HttpHost("http", "foo.example.com", -1);
+ final HttpHost host2 = new HttpHost("HTTP", "foo.example.com", -1);
final HttpRequest req = new BasicHttpRequest("GET", "/");
Assert.assertEquals(extractor.generateKey(host1, req), extractor.generateKey(host2, req));
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/schedule/TestExponentialBackingOffSchedulingStrategy.java
----------------------------------------------------------------------
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/schedule/TestExponentialBackingOffSchedulingStrategy.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/schedule/TestExponentialBackingOffSchedulingStrategy.java
index 65181c9..83d25b6 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/schedule/TestExponentialBackingOffSchedulingStrategy.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/schedule/TestExponentialBackingOffSchedulingStrategy.java
@@ -46,14 +46,14 @@ public class TestExponentialBackingOffSchedulingStrategy {
@Test
public void testSchedule() {
- Assert.assertEquals(TimeValue.ofMillis(0), impl.schedule(0));
- Assert.assertEquals(TimeValue.ofMillis(6000), impl.schedule(1));
- Assert.assertEquals(TimeValue.ofMillis(60000), impl.schedule(2));
- Assert.assertEquals(TimeValue.ofMillis(600000), impl.schedule(3));
- Assert.assertEquals(TimeValue.ofMillis(6000000), impl.schedule(4));
- Assert.assertEquals(TimeValue.ofMillis(60000000), impl.schedule(5));
- Assert.assertEquals(TimeValue.ofMillis(86400000), impl.schedule(6));
- Assert.assertEquals(TimeValue.ofMillis(86400000), impl.schedule(Integer.MAX_VALUE));
+ Assert.assertEquals(TimeValue.ofMilliseconds(0), impl.schedule(0));
+ Assert.assertEquals(TimeValue.ofMilliseconds(6000), impl.schedule(1));
+ Assert.assertEquals(TimeValue.ofMilliseconds(60000), impl.schedule(2));
+ Assert.assertEquals(TimeValue.ofMilliseconds(600000), impl.schedule(3));
+ Assert.assertEquals(TimeValue.ofMilliseconds(6000000), impl.schedule(4));
+ Assert.assertEquals(TimeValue.ofMilliseconds(60000000), impl.schedule(5));
+ Assert.assertEquals(TimeValue.ofMilliseconds(86400000), impl.schedule(6));
+ Assert.assertEquals(TimeValue.ofMilliseconds(86400000), impl.schedule(Integer.MAX_VALUE));
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncEchoHandler.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncEchoHandler.java b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncEchoHandler.java
index 98affe3..b1c58b9 100644
--- a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncEchoHandler.java
+++ b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncEchoHandler.java
@@ -125,8 +125,8 @@ public class AsyncEchoHandler implements AsyncServerExchangeHandler {
}
@Override
- public int consume(final ByteBuffer src) throws IOException {
- return entityConsumer.consume(src);
+ public void consume(final ByteBuffer src) throws IOException {
+ entityConsumer.consume(src);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java
index 3f6d543..fbbe612 100644
--- a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java
+++ b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java
@@ -123,8 +123,7 @@ public class AsyncRandomHandler implements AsyncServerExchangeHandler {
}
@Override
- public int consume(final ByteBuffer src) throws IOException {
- return Integer.MAX_VALUE;
+ public void consume(final ByteBuffer src) throws IOException {
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java
index 2a8b5a4..030bc26 100644
--- a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java
+++ b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java
@@ -119,12 +119,10 @@ public class AuthenticatingAsyncDecorator implements AsyncServerExchangeHandler
}
@Override
- public final int consume(final ByteBuffer src) throws IOException {
+ public final void consume(final ByteBuffer src) throws IOException {
final AsyncResponseProducer responseProducer = responseProducerRef.get();
if (responseProducer == null) {
- return exchangeHandler.consume(src);
- } else {
- return Integer.MAX_VALUE;
+ exchangeHandler.consume(src);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttp1IntegrationTestBase.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttp1IntegrationTestBase.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttp1IntegrationTestBase.java
index 59b46b8..074f4e3 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttp1IntegrationTestBase.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttp1IntegrationTestBase.java
@@ -116,7 +116,7 @@ public abstract class AbstractHttp1IntegrationTestBase extends AbstractServerTes
httpclient.start();
final ListenerEndpoint endpoint = endpointFuture.get();
final InetSocketAddress address = (InetSocketAddress) endpoint.getAddress();
- return new HttpHost("localhost", address.getPort(), scheme.name());
+ return new HttpHost(scheme.name(), "localhost", address.getPort());
}
public HttpHost start(
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncRedirectsTest.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncRedirectsTest.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncRedirectsTest.java
index e98a140..9ceafa5 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncRedirectsTest.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncRedirectsTest.java
@@ -249,7 +249,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
Assert.assertEquals("/newlocation/", request.getRequestUri());
- Assert.assertEquals(target, new HttpHost(request.getAuthority(), request.getScheme()));
+ Assert.assertEquals(target, new HttpHost(request.getScheme(), request.getAuthority()));
}
@Test
@@ -273,7 +273,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
Assert.assertEquals("/newlocation/", request.getRequestUri());
- Assert.assertEquals(target, new HttpHost(request.getAuthority(), request.getScheme()));
+ Assert.assertEquals(target, new HttpHost(request.getScheme(), request.getAuthority()));
}
@Test
@@ -304,7 +304,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
final HttpRequest request = context.getRequest();
Assert.assertEquals(HttpStatus.SC_MOVED_TEMPORARILY, response.getCode());
Assert.assertEquals("/oldlocation/", request.getRequestUri());
- Assert.assertEquals(target, new HttpHost(request.getAuthority(), request.getScheme()));
+ Assert.assertEquals(target, new HttpHost(request.getScheme(), request.getAuthority()));
}
@Test
@@ -328,7 +328,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
Assert.assertEquals("/newlocation/", request.getRequestUri());
- Assert.assertEquals(target, new HttpHost(request.getAuthority(), request.getScheme()));
+ Assert.assertEquals(target, new HttpHost(request.getScheme(), request.getAuthority()));
}
@Test
@@ -398,7 +398,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
Assert.assertEquals("/newlocation/", request.getRequestUri());
- Assert.assertEquals(target, new HttpHost(request.getAuthority(), request.getScheme()));
+ Assert.assertEquals(target, new HttpHost(request.getScheme(), request.getAuthority()));
}
@Test(expected=ExecutionException.class)
@@ -503,7 +503,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
Assert.assertEquals("/relativelocation/", request.getRequestUri());
- Assert.assertEquals(target, new HttpHost(request.getAuthority(), request.getScheme()));
+ Assert.assertEquals(target, new HttpHost(request.getScheme(), request.getAuthority()));
}
@Test
@@ -529,7 +529,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
Assert.assertEquals("/test/relativelocation", request.getRequestUri());
- Assert.assertEquals(target, new HttpHost(request.getAuthority(), request.getScheme()));
+ Assert.assertEquals(target, new HttpHost(request.getScheme(), request.getAuthority()));
}
static class BogusRedirectService extends AbstractSimpleServerExchangeHandler {
@@ -707,7 +707,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
final ListenerEndpoint endpoint2 = endpointFuture.get();
final InetSocketAddress address2 = (InetSocketAddress) endpoint2.getAddress();
- final HttpHost initialTarget = new HttpHost("localhost", address2.getPort(), scheme.name());
+ final HttpHost initialTarget = new HttpHost(scheme.name(), "localhost", address2.getPort());
final Queue<Future<SimpleHttpResponse>> queue = new ConcurrentLinkedQueue<>();
for (int i = 0; i < 1; i++) {
@@ -776,7 +776,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
Assert.assertEquals(HttpStatus.SC_OK, response2.getCode());
Assert.assertEquals("/rome", request.getRequestUri());
- Assert.assertEquals(target, new HttpHost(request.getAuthority(), request.getScheme()));
+ Assert.assertEquals(target, new HttpHost(request.getScheme(), request.getAuthority()));
}
@Test
@@ -807,7 +807,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
Assert.assertEquals(HttpStatus.SC_OK, response2.getCode());
Assert.assertEquals("/rome", request.getRequestUri());
- Assert.assertEquals(target, new HttpHost(request.getAuthority(), request.getScheme()));
+ Assert.assertEquals(target, new HttpHost(request.getScheme(), request.getAuthority()));
}
@Test
@@ -839,7 +839,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
Assert.assertEquals(HttpStatus.SC_OK, response2.getCode());
Assert.assertEquals("/rome", request.getRequestUri());
- Assert.assertEquals(target, new HttpHost(request.getAuthority(), request.getScheme()));
+ Assert.assertEquals(target, new HttpHost(request.getScheme(), request.getAuthority()));
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractIntegrationTestBase.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractIntegrationTestBase.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractIntegrationTestBase.java
index 808f5db..422837b 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractIntegrationTestBase.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractIntegrationTestBase.java
@@ -82,7 +82,7 @@ public abstract class AbstractIntegrationTestBase<T extends CloseableHttpAsyncCl
httpclient.start();
final ListenerEndpoint endpoint = endpointFuture.get();
final InetSocketAddress address = (InetSocketAddress) endpoint.getAddress();
- return new HttpHost("localhost", address.getPort(), scheme.name());
+ return new HttpHost(scheme.name(), "localhost", address.getPort());
}
public final HttpHost start(
@@ -101,7 +101,7 @@ public abstract class AbstractIntegrationTestBase<T extends CloseableHttpAsyncCl
httpclient.start();
final ListenerEndpoint endpoint = endpointFuture.get();
final InetSocketAddress address = (InetSocketAddress) endpoint.getAddress();
- return new HttpHost("localhost", address.getPort(), scheme.name());
+ return new HttpHost(scheme.name(), "localhost", address.getPort());
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncRedirects.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncRedirects.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncRedirects.java
index 02518f8..75f0a8d 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncRedirects.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncRedirects.java
@@ -211,7 +211,7 @@ public class TestHttp1AsyncRedirects extends AbstractHttpAsyncRedirectsTest<Clos
Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
Assert.assertEquals("/newlocation/", request.getRequestUri());
- Assert.assertEquals(target, new HttpHost(request.getAuthority(), request.getScheme()));
+ Assert.assertEquals(target, new HttpHost(request.getScheme(), request.getAuthority()));
}
@Test
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncStatefulConnManagement.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncStatefulConnManagement.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncStatefulConnManagement.java
index f58fe60..6411eb7 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncStatefulConnManagement.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncStatefulConnManagement.java
@@ -293,7 +293,7 @@ public class TestHttp1AsyncStatefulConnManagement extends AbstractIntegrationTes
final HttpContext context2 = new BasicHttpContext();
final Future<SimpleHttpResponse> future2 = httpclient.execute(SimpleHttpRequests.GET.create(
- new HttpHost("127.0.0.1", target.getPort(), target.getSchemeName()),"/"), context2, null);
+ new HttpHost(target.getSchemeName(), "127.0.0.1", target.getPort()),"/"), context2, null);
final HttpResponse response2 = future2.get();
Assert.assertNotNull(response2);
Assert.assertEquals(200, response2.getCode());
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/CachingHttpAsyncClientCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/CachingHttpAsyncClientCompatibilityTest.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/CachingHttpAsyncClientCompatibilityTest.java
index fcffd94..7262f88 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/CachingHttpAsyncClientCompatibilityTest.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/CachingHttpAsyncClientCompatibilityTest.java
@@ -65,9 +65,9 @@ public class CachingHttpAsyncClientCompatibilityTest {
public static void main(final String... args) throws Exception {
final CachingHttpAsyncClientCompatibilityTest[] tests = new CachingHttpAsyncClientCompatibilityTest[] {
new CachingHttpAsyncClientCompatibilityTest(
- HttpVersion.HTTP_1_1, new HttpHost("localhost", 8080, "http")),
+ HttpVersion.HTTP_1_1, new HttpHost("http", "localhost", 8080)),
new CachingHttpAsyncClientCompatibilityTest(
- HttpVersion.HTTP_2_0, new HttpHost("localhost", 8080, "http"))
+ HttpVersion.HTTP_2_0, new HttpHost("http", "localhost", 8080))
};
for (final CachingHttpAsyncClientCompatibilityTest test: tests) {
try {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/CachingHttpClientCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/CachingHttpClientCompatibilityTest.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/CachingHttpClientCompatibilityTest.java
index ee3ba86..6c248b2 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/CachingHttpClientCompatibilityTest.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/CachingHttpClientCompatibilityTest.java
@@ -60,7 +60,7 @@ public class CachingHttpClientCompatibilityTest {
public static void main(final String... args) throws Exception {
final CachingHttpClientCompatibilityTest[] tests = new CachingHttpClientCompatibilityTest[] {
new CachingHttpClientCompatibilityTest(
- new HttpHost("localhost", 8080, "http"))
+ new HttpHost("http", "localhost", 8080))
};
for (final CachingHttpClientCompatibilityTest test: tests) {
try {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpAsyncClientCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpAsyncClientCompatibilityTest.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpAsyncClientCompatibilityTest.java
index 3de9866..7132afb 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpAsyncClientCompatibilityTest.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpAsyncClientCompatibilityTest.java
@@ -65,30 +65,30 @@ public class HttpAsyncClientCompatibilityTest {
final HttpAsyncClientCompatibilityTest[] tests = new HttpAsyncClientCompatibilityTest[] {
new HttpAsyncClientCompatibilityTest(
HttpVersion.HTTP_1_1,
- new HttpHost("localhost", 8080, "http"), null, null),
+ new HttpHost("http", "localhost", 8080), null, null),
new HttpAsyncClientCompatibilityTest(
HttpVersion.HTTP_1_1,
- new HttpHost("test-httpd", 8080, "http"), new HttpHost("localhost", 8888), null),
+ new HttpHost("http", "test-httpd", 8080), new HttpHost("localhost", 8888), null),
new HttpAsyncClientCompatibilityTest(
HttpVersion.HTTP_1_1,
- new HttpHost("test-httpd", 8080, "http"), new HttpHost("localhost", 8889),
+ new HttpHost("http", "test-httpd", 8080), new HttpHost("localhost", 8889),
new UsernamePasswordCredentials("squid", "nopassword".toCharArray())),
new HttpAsyncClientCompatibilityTest(
HttpVersion.HTTP_1_1,
- new HttpHost("localhost", 8443, "https"), null, null),
+ new HttpHost("https", "localhost", 8443), null, null),
new HttpAsyncClientCompatibilityTest(
HttpVersion.HTTP_1_1,
- new HttpHost("test-httpd", 8443, "https"), new HttpHost("localhost", 8888), null),
+ new HttpHost("https", "test-httpd", 8443), new HttpHost("localhost", 8888), null),
new HttpAsyncClientCompatibilityTest(
HttpVersion.HTTP_1_1,
- new HttpHost("test-httpd", 8443, "https"), new HttpHost("localhost", 8889),
+ new HttpHost("https", "test-httpd", 8443), new HttpHost("localhost", 8889),
new UsernamePasswordCredentials("squid", "nopassword".toCharArray())),
new HttpAsyncClientCompatibilityTest(
HttpVersion.HTTP_2_0,
- new HttpHost("localhost", 8080, "http"), null, null),
+ new HttpHost("http", "localhost", 8080), null, null),
new HttpAsyncClientCompatibilityTest(
HttpVersion.HTTP_2_0,
- new HttpHost("localhost", 8443, "https"), null, null)
+ new HttpHost("https", "localhost", 8443), null, null)
};
for (final HttpAsyncClientCompatibilityTest test: tests) {
try {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpClientCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpClientCompatibilityTest.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpClientCompatibilityTest.java
index 42cfc60..e1f3f8b 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpClientCompatibilityTest.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/external/HttpClientCompatibilityTest.java
@@ -59,18 +59,18 @@ public class HttpClientCompatibilityTest {
public static void main(final String... args) throws Exception {
final HttpClientCompatibilityTest[] tests = new HttpClientCompatibilityTest[] {
new HttpClientCompatibilityTest(
- new HttpHost("localhost", 8080, "http"), null, null),
+ new HttpHost("http", "localhost", 8080), null, null),
new HttpClientCompatibilityTest(
- new HttpHost("test-httpd", 8080, "http"), new HttpHost("localhost", 8888), null),
+ new HttpHost("http", "test-httpd", 8080), new HttpHost("localhost", 8888), null),
new HttpClientCompatibilityTest(
- new HttpHost("test-httpd", 8080, "http"), new HttpHost("localhost", 8889),
+ new HttpHost("http", "test-httpd", 8080), new HttpHost("localhost", 8889),
new UsernamePasswordCredentials("squid", "nopassword".toCharArray())),
new HttpClientCompatibilityTest(
- new HttpHost("localhost", 8443, "https"), null, null),
+ new HttpHost("https", "localhost", 8443), null, null),
new HttpClientCompatibilityTest(
- new HttpHost("test-httpd", 8443, "https"), new HttpHost("localhost", 8888), null),
+ new HttpHost("https", "test-httpd", 8443), new HttpHost("localhost", 8888), null),
new HttpClientCompatibilityTest(
- new HttpHost("test-httpd", 8443, "https"), new HttpHost("localhost", 8889),
+ new HttpHost("https", "test-httpd", 8443), new HttpHost("localhost", 8889),
new UsernamePasswordCredentials("squid", "nopassword".toCharArray()))
};
for (final HttpClientCompatibilityTest test: tests) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/LocalServerTestBase.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/LocalServerTestBase.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/LocalServerTestBase.java
index 60b7dbe..d0cda8b 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/LocalServerTestBase.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/LocalServerTestBase.java
@@ -134,7 +134,7 @@ public abstract class LocalServerTestBase {
this.httpclient = this.clientBuilder.build();
}
- return new HttpHost("localhost", this.server.getPort(), this.scheme.name());
+ return new HttpHost(this.scheme.name(), "localhost", this.server.getPort());
}
public HttpHost start() throws Exception {
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestConnectionManagement.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestConnectionManagement.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestConnectionManagement.java
index 89267c2..e58cadf 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestConnectionManagement.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestConnectionManagement.java
@@ -97,7 +97,7 @@ public class TestConnectionManagement extends LocalServerTestBase {
try {
// this should fail quickly, connection has not been released
final LeaseRequest leaseRequest2 = this.connManager.lease(route, null);
- leaseRequest2.get(Timeout.ofMillis(10));
+ leaseRequest2.get(Timeout.ofMilliseconds(10));
Assert.fail("TimeoutException expected");
} catch (final TimeoutException ex) {
// expected
@@ -165,14 +165,14 @@ public class TestConnectionManagement extends LocalServerTestBase {
try {
// this should fail quickly, connection has not been released
final LeaseRequest leaseRequest2 = this.connManager.lease(route, null);
- leaseRequest2.get(Timeout.ofMillis(10));
+ leaseRequest2.get(Timeout.ofMilliseconds(10));
Assert.fail("TimeoutException expected");
} catch (final TimeoutException ex) {
// expected
}
endpoint1.close();
- this.connManager.release(endpoint1, null, TimeValue.ofMillis(100));
+ this.connManager.release(endpoint1, null, TimeValue.ofMilliseconds(100));
final LeaseRequest leaseRequest2 = this.connManager.lease(route, null);
final ConnectionEndpoint endpoint2 = leaseRequest2.get(Timeout.ZERO_MILLISECONDS);
@@ -184,7 +184,7 @@ public class TestConnectionManagement extends LocalServerTestBase {
Assert.assertEquals(HttpStatus.SC_OK, response2.getCode());
}
- this.connManager.release(endpoint2, null, TimeValue.ofMillis(100));
+ this.connManager.release(endpoint2, null, TimeValue.ofMilliseconds(100));
final LeaseRequest leaseRequest3 = this.connManager.lease(route, null);
final ConnectionEndpoint endpoint3 = leaseRequest3.get(Timeout.ZERO_MILLISECONDS);
@@ -195,7 +195,7 @@ public class TestConnectionManagement extends LocalServerTestBase {
Assert.assertEquals(HttpStatus.SC_OK, response3.getCode());
}
- this.connManager.release(endpoint3, null, TimeValue.ofMillis(100));
+ this.connManager.release(endpoint3, null, TimeValue.ofMilliseconds(100));
Thread.sleep(150);
final LeaseRequest leaseRequest4 = this.connManager.lease(route, null);
@@ -228,7 +228,7 @@ public class TestConnectionManagement extends LocalServerTestBase {
Assert.assertEquals(1, this.connManager.getTotalStats().getLeased());
Assert.assertEquals(1, this.connManager.getStats(route).getLeased());
- this.connManager.release(endpoint1, null, TimeValue.ofMillis(100));
+ this.connManager.release(endpoint1, null, TimeValue.ofMilliseconds(100));
// Released, still active.
Assert.assertEquals(1, this.connManager.getTotalStats().getAvailable());
@@ -261,7 +261,7 @@ public class TestConnectionManagement extends LocalServerTestBase {
.build(),
PoolConcurrencyPolicy.STRICT,
PoolReusePolicy.LIFO,
- TimeValue.ofMillis(100));
+ TimeValue.ofMilliseconds(100));
this.clientBuilder.setConnectionManager(this.connManager);
this.connManager.setMaxTotal(1);
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestIdleConnectionEviction.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestIdleConnectionEviction.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestIdleConnectionEviction.java
index a2ac66f..c66b395 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestIdleConnectionEviction.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestIdleConnectionEviction.java
@@ -47,7 +47,7 @@ public class TestIdleConnectionEviction extends LocalServerTestBase {
final HttpHost target = start();
- final IdleConnectionEvictor idleConnectionMonitor = new IdleConnectionEvictor(this.connManager, TimeValue.ofMillis(50));
+ final IdleConnectionEvictor idleConnectionMonitor = new IdleConnectionEvictor(this.connManager, TimeValue.ofMilliseconds(50));
idleConnectionMonitor.start();
final HttpGet httpget = new HttpGet("/random/1024");
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestSSLSocketFactory.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestSSLSocketFactory.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestSSLSocketFactory.java
index bfc4b67..2ffb065 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestSSLSocketFactory.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestSSLSocketFactory.java
@@ -108,7 +108,7 @@ public class TestSSLSocketFactory {
SSLTestContexts.createClientSSLContext(), hostVerifier);
try (final Socket socket = socketFactory.createSocket(context)) {
final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
- final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
+ final HttpHost target = new HttpHost("https", "localhost", this.server.getLocalPort());
try (final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(
TimeValue.ZERO_MILLISECONDS,
socket,
@@ -139,7 +139,7 @@ public class TestSSLSocketFactory {
.build();
try (final Socket socket = socketFactory.createSocket(context)) {
final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
- final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
+ final HttpHost target = new HttpHost("https", "localhost", this.server.getLocalPort());
try (final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(
TimeValue.ZERO_MILLISECONDS,
socket,
@@ -169,7 +169,7 @@ public class TestSSLSocketFactory {
SSLTestContexts.createClientSSLContext(), hostVerifier);
try (final Socket socket = socketFactory.createSocket(context)) {
final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
- final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
+ final HttpHost target = new HttpHost("https", "localhost", this.server.getLocalPort());
try (final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(
TimeValue.ZERO_MILLISECONDS,
socket,
@@ -208,7 +208,7 @@ public class TestSSLSocketFactory {
SSLTestContexts.createClientSSLContext(), hostVerifier);
try (final Socket socket = socketFactory.createSocket(context)) {
final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
- final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
+ final HttpHost target = new HttpHost("https", "localhost", this.server.getLocalPort());
try (final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(
TimeValue.ZERO_MILLISECONDS,
socket, target,
@@ -242,7 +242,7 @@ public class TestSSLSocketFactory {
try (final Socket socket = socketFactory.createSocket(context)) {
final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
- final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
+ final HttpHost target = new HttpHost("https", "localhost", this.server.getLocalPort());
try (final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(TimeValue.ZERO_MILLISECONDS, socket, target, remoteAddress,
null, context)) {
// empty for now
@@ -294,7 +294,7 @@ public class TestSSLSocketFactory {
try (final Socket socket = socketFactory.createSocket(context)) {
final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
- final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
+ final HttpHost target = new HttpHost("https", "localhost", this.server.getLocalPort());
try (final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(TimeValue.ZERO_MILLISECONDS, socket, target, remoteAddress,
null, context)) {
// empty for now
@@ -324,7 +324,7 @@ public class TestSSLSocketFactory {
SSLTestContexts.createClientSSLContext());
try (final Socket socket = socketFactory.createSocket(context)) {
final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
- final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
+ final HttpHost target = new HttpHost("https", "localhost", this.server.getLocalPort());
try (final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(TimeValue.ZERO_MILLISECONDS, socket, target, remoteAddress,
null, context)) {
final SSLSession sslsession = sslSocket.getSession();
@@ -355,7 +355,7 @@ public class TestSSLSocketFactory {
SSLTestContexts.createClientSSLContext());
try (final Socket socket = socketFactory.createSocket(context)) {
final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
- final HttpHost target = new HttpHost("localhost", this.server.getLocalPort(), "https");
+ final HttpHost target = new HttpHost("https", "localhost", this.server.getLocalPort());
socketFactory.connectSocket(TimeValue.ZERO_MILLISECONDS, socket, target, remoteAddress, null, context);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientCustomSSL.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientCustomSSL.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientCustomSSL.java
index 2776f64..2a2f9de 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientCustomSSL.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientCustomSSL.java
@@ -97,7 +97,7 @@ public class AsyncClientCustomSSL {
client.start();
- final HttpHost target = new HttpHost("httpbin.org", 443, "https");
+ final HttpHost target = new HttpHost("https", "httpbin.org", 443);
final String requestUri = "/";
final HttpClientContext clientContext = HttpClientContext.create();
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientFullDuplexExchange.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientFullDuplexExchange.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientFullDuplexExchange.java
index d2a7f7e..a0d965a 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientFullDuplexExchange.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientFullDuplexExchange.java
@@ -138,8 +138,8 @@ public class AsyncClientFullDuplexExchange {
}
@Override
- public int consume(final ByteBuffer src) throws IOException {
- return responseConsumer.consume(src);
+ public void consume(final ByteBuffer src) throws IOException {
+ responseConsumer.consume(src);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java
index e5cd96f..9599ddb 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java
@@ -134,8 +134,8 @@ public class AsyncClientHttp2FullDuplexExchange {
}
@Override
- public int consume(final ByteBuffer src) throws IOException {
- return responseConsumer.consume(src);
+ public void consume(final ByteBuffer src) throws IOException {
+ responseConsumer.consume(src);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java
index 2aea69f..bbb17b0 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java
@@ -88,11 +88,6 @@ public class AsyncClientHttp2ServerPush {
}
@Override
- protected int remainingCapacity() {
- return Integer.MAX_VALUE;
- }
-
- @Override
protected int capacityIncrement() {
return Integer.MAX_VALUE;
}
@@ -133,11 +128,6 @@ public class AsyncClientHttp2ServerPush {
}
@Override
- protected int remainingCapacity() {
- return Integer.MAX_VALUE;
- }
-
- @Override
protected int capacityIncrement() {
return Integer.MAX_VALUE;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java
index 03c349b..4a955b9 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java
@@ -76,11 +76,6 @@ public class AsyncClientHttpExchangeStreaming {
}
@Override
- protected int remainingCapacity() {
- return Integer.MAX_VALUE;
- }
-
- @Override
protected int capacityIncrement() {
return Integer.MAX_VALUE;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientTlsAlpn.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientTlsAlpn.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientTlsAlpn.java
index aa1c6bf..151615c 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientTlsAlpn.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncClientTlsAlpn.java
@@ -79,7 +79,7 @@ public class AsyncClientTlsAlpn {
client.start();
- final HttpHost target = new HttpHost("nghttp2.org", 443, "https");
+ final HttpHost target = new HttpHost("https", "nghttp2.org", 443);
final String requestUri = "/httpbin/";
final HttpClientContext clientContext = HttpClientContext.create();
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncQuickStart.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncQuickStart.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncQuickStart.java
index a6d0551..121398c 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncQuickStart.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/AsyncQuickStart.java
@@ -101,11 +101,6 @@ public class AsyncQuickStart {
}
@Override
- protected int remainingCapacity() {
- return Integer.MAX_VALUE;
- }
-
- @Override
protected int capacityIncrement() {
return Integer.MAX_VALUE;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientExecuteProxy.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientExecuteProxy.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientExecuteProxy.java
index 90cb2c8..30d4751 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientExecuteProxy.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientExecuteProxy.java
@@ -44,8 +44,8 @@ public class ClientExecuteProxy {
public static void main(final String[] args)throws Exception {
try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
- final HttpHost target = new HttpHost("httpbin.org", 443, "https");
- final HttpHost proxy = new HttpHost("127.0.0.1", 8080, "http");
+ final HttpHost target = new HttpHost("https", "httpbin.org", 443);
+ final HttpHost proxy = new HttpHost("http", "127.0.0.1", 8080);
final RequestConfig config = RequestConfig.custom()
.setProxy(proxy)
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientExecuteSOCKS.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientExecuteSOCKS.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientExecuteSOCKS.java
index 7cb7813..9cda6a3 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientExecuteSOCKS.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientExecuteSOCKS.java
@@ -67,7 +67,7 @@ public class ClientExecuteSOCKS {
final HttpClientContext context = HttpClientContext.create();
context.setAttribute("socks.address", socksaddr);
- final HttpHost target = new HttpHost("httpbin.org", 80, "http");
+ final HttpHost target = new HttpHost("http", "httpbin.org", 80);
final HttpGet request = new HttpGet("/get");
System.out.println("Executing request " + request.getMethod() + " " + request.getUri() +
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientPreemptiveBasicAuthentication.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientPreemptiveBasicAuthentication.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientPreemptiveBasicAuthentication.java
index 5eda2e6..de13335 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientPreemptiveBasicAuthentication.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientPreemptiveBasicAuthentication.java
@@ -53,7 +53,7 @@ public class ClientPreemptiveBasicAuthentication {
final BasicScheme basicAuth = new BasicScheme();
basicAuth.initPreemptive(new UsernamePasswordCredentials("user", "passwd".toCharArray()));
- final HttpHost target = new HttpHost("httpbin.org", 80, "http");
+ final HttpHost target = new HttpHost("http", "httpbin.org", 80);
// Add AuthCache to the execution context
final HttpClientContext localContext = HttpClientContext.create();
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientPreemptiveDigestAuthentication.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientPreemptiveDigestAuthentication.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientPreemptiveDigestAuthentication.java
index 04b99fd..2f40701 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientPreemptiveDigestAuthentication.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientPreemptiveDigestAuthentication.java
@@ -51,7 +51,7 @@ public class ClientPreemptiveDigestAuthentication {
public static void main(final String[] args) throws Exception {
try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
- final HttpHost target = new HttpHost("httpbin.org", 80, "http");
+ final HttpHost target = new HttpHost("http", "httpbin.org", 80);
final HttpClientContext localContext = HttpClientContext.create();
final BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientProxyAuthentication.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientProxyAuthentication.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientProxyAuthentication.java
index 7186fb4..18e136a 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientProxyAuthentication.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ClientProxyAuthentication.java
@@ -53,7 +53,7 @@ public class ClientProxyAuthentication {
new UsernamePasswordCredentials("user", "passwd".toCharArray()));
try (CloseableHttpClient httpclient = HttpClients.custom()
.setDefaultCredentialsProvider(credsProvider).build()) {
- final HttpHost target = new HttpHost("httpbin.org", 80, "http");
+ final HttpHost target = new HttpHost("http", "httpbin.org", 80);
final HttpHost proxy = new HttpHost("localhost", 8888);
final RequestConfig config = RequestConfig.custom()
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/examples/org/apache/hc/client5/http/examples/ReactiveClientFullDuplexExchange.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ReactiveClientFullDuplexExchange.java b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ReactiveClientFullDuplexExchange.java
index d81ae24..12e427d 100644
--- a/httpclient5/src/examples/org/apache/hc/client5/http/examples/ReactiveClientFullDuplexExchange.java
+++ b/httpclient5/src/examples/org/apache/hc/client5/http/examples/ReactiveClientFullDuplexExchange.java
@@ -26,11 +26,12 @@
*/
package org.apache.hc.client5.http.examples;
-import io.reactivex.Flowable;
-import io.reactivex.Notification;
-import io.reactivex.Observable;
-import io.reactivex.functions.Consumer;
-import io.reactivex.functions.Function;
+import java.net.URI;
+import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+
import org.apache.hc.client5.http.impl.async.HttpAsyncClients;
import org.apache.hc.client5.http.impl.async.MinimalHttpAsyncClient;
import org.apache.hc.core5.http.ContentType;
@@ -48,11 +49,11 @@ import org.apache.hc.core5.reactor.IOReactorConfig;
import org.apache.hc.core5.util.Timeout;
import org.reactivestreams.Publisher;
-import java.net.URI;
-import java.nio.ByteBuffer;
-import java.nio.charset.StandardCharsets;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
+import io.reactivex.Flowable;
+import io.reactivex.Notification;
+import io.reactivex.Observable;
+import io.reactivex.functions.Consumer;
+import io.reactivex.functions.Function;
/**
* This example demonstrates a reactive, full-duplex HTTP/1.1 message exchange using RxJava.
@@ -85,7 +86,7 @@ public class ReactiveClientFullDuplexExchange {
final Message<HttpResponse, Publisher<ByteBuffer>> streamingResponse = consumer.getResponseFuture().get();
System.out.println(streamingResponse.getHead());
- for (Header header : streamingResponse.getHead().getAllHeaders()) {
+ for (Header header : streamingResponse.getHead().getHeaders()) {
System.out.println(header.toString());
}
System.out.println();
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/impl/AuthSupport.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/AuthSupport.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/AuthSupport.java
index 823e600..e6685a4 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/AuthSupport.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/AuthSupport.java
@@ -28,10 +28,10 @@
package org.apache.hc.client5.http.impl;
import org.apache.hc.client5.http.HttpRoute;
+import org.apache.hc.client5.http.auth.AuthSchemes;
import org.apache.hc.client5.http.auth.AuthScope;
import org.apache.hc.client5.http.auth.CredentialsStore;
import org.apache.hc.client5.http.auth.UsernamePasswordCredentials;
-import org.apache.hc.client5.http.auth.AuthSchemes;
import org.apache.hc.core5.annotation.Internal;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpRequest;
@@ -78,12 +78,12 @@ public class AuthSupport {
Args.notNull(route, "Route");
final URIAuthority authority = request.getAuthority();
final String scheme = request.getScheme();
- final HttpHost target = authority != null ? new HttpHost(authority, scheme) : route.getTargetHost();
+ final HttpHost target = authority != null ? new HttpHost(scheme, authority) : route.getTargetHost();
if (target.getPort() < 0) {
return new HttpHost(
+ target.getSchemeName(),
target.getHostName(),
- route.getTargetHost().getPort(),
- target.getSchemeName());
+ route.getTargetHost().getPort());
}
return target;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncMainClientExec.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncMainClientExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncMainClientExec.java
index fcf180b..4d2b52f 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncMainClientExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncMainClientExec.java
@@ -151,12 +151,10 @@ public class Http2AsyncMainClientExec implements AsyncExecChainHandler {
}
@Override
- public int consume(final ByteBuffer src) throws IOException {
+ public void consume(final ByteBuffer src) throws IOException {
final AsyncDataConsumer entityConsumer = entityConsumerRef.get();
if (entityConsumer != null) {
- return entityConsumer.consume(src);
- } else {
- return Integer.MAX_VALUE;
+ entityConsumer.consume(src);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java
index fbc4b89..72dbbc4 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncMainClientExec.java
@@ -214,12 +214,10 @@ class HttpAsyncMainClientExec implements AsyncExecChainHandler {
}
@Override
- public int consume(final ByteBuffer src) throws IOException {
+ public void consume(final ByteBuffer src) throws IOException {
final AsyncDataConsumer entityConsumer = entityConsumerRef.get();
if (entityConsumer != null) {
- return entityConsumer.consume(src);
- } else {
- return Integer.MAX_VALUE;
+ entityConsumer.consume(src);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingAsyncClientExchangeHandler.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingAsyncClientExchangeHandler.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingAsyncClientExchangeHandler.java
index 66356ee..175e1ea 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingAsyncClientExchangeHandler.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingAsyncClientExchangeHandler.java
@@ -169,11 +169,11 @@ final class LoggingAsyncClientExchangeHandler implements AsyncClientExchangeHand
}
@Override
- public int consume(final ByteBuffer src) throws IOException {
+ public void consume(final ByteBuffer src) throws IOException {
if (log.isDebugEnabled()) {
log.debug(exchangeId + ": consume response data, len " + src.remaining() + " bytes");
}
- return handler.consume(src);
+ handler.consume(src);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java
index 680f3fe..c4f8a64 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java
@@ -243,6 +243,11 @@ class LoggingIOSession implements ProtocolIOSession {
}
@Override
+ public NamedEndpoint getInitialEndpoint() {
+ return session.getInitialEndpoint();
+ }
+
+ @Override
public String toString() {
return this.id + " " + this.session.toString();
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java
index 7e7b82d..1f646aa 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java
@@ -154,7 +154,7 @@ public final class MinimalHttp2AsyncClient extends AbstractMinimalHttpAsyncClien
requestConfig = clientContext.getRequestConfig();
}
final Timeout connectTimeout = requestConfig.getConnectTimeout();
- final HttpHost target = new HttpHost(request.getAuthority(), request.getScheme());
+ final HttpHost target = new HttpHost(request.getScheme(), request.getAuthority());
final Future<IOSession> sessionFuture = connPool.getSession(target, connectTimeout, new FutureCallback<IOSession>() {
@@ -215,8 +215,8 @@ public final class MinimalHttp2AsyncClient extends AbstractMinimalHttpAsyncClien
}
@Override
- public int consume(final ByteBuffer src) throws IOException {
- return exchangeHandler.consume(src);
+ public void consume(final ByteBuffer src) throws IOException {
+ exchangeHandler.consume(src);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java
index a8ef3dc..32940e0 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java
@@ -266,7 +266,7 @@ public final class MinimalHttpAsyncClient extends AbstractMinimalHttpAsyncClient
final Timeout connectionRequestTimeout = requestConfig.getConnectionRequestTimeout();
final Timeout connectTimeout = requestConfig.getConnectTimeout();
final Timeout responseTimeout = requestConfig.getResponseTimeout();
- final HttpHost target = new HttpHost(request.getAuthority(), request.getScheme());
+ final HttpHost target = new HttpHost(request.getScheme(), request.getAuthority());
final Future<AsyncConnectionEndpoint> leaseFuture = leaseEndpoint(
target,
@@ -381,8 +381,8 @@ public final class MinimalHttpAsyncClient extends AbstractMinimalHttpAsyncClient
}
@Override
- public int consume(final ByteBuffer src) throws IOException {
- return exchangeHandler.consume(src);
+ public void consume(final ByteBuffer src) throws IOException {
+ exchangeHandler.consume(src);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/CloseableHttpResponse.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/CloseableHttpResponse.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/CloseableHttpResponse.java
index 204a82a..a936d06 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/CloseableHttpResponse.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/CloseableHttpResponse.java
@@ -93,15 +93,6 @@ public final class CloseableHttpResponse implements ClassicHttpResponse {
return response.getReasonPhrase();
}
- /**
- * @deprecated use {@link #countHeaders(String)}
- */
- @Override
- @Deprecated
- public int containsHeaders(final String name) {
- return countHeaders(name);
- }
-
@Override
public int countHeaders(final String name) {
return response.countHeaders(name);
@@ -147,15 +138,6 @@ public final class CloseableHttpResponse implements ClassicHttpResponse {
response.setLocale(loc);
}
- /**
- * @deprecated use {@link #getHeader(String)}
- */
- @Override
- @Deprecated
- public Header getSingleHeader(final String name) throws ProtocolException {
- return getHeader(name);
- }
-
@Override
public Header getHeader(final String name) throws ProtocolException {
return response.getHeader(name);
@@ -196,15 +178,6 @@ public final class CloseableHttpResponse implements ClassicHttpResponse {
return response.getLastHeader(name);
}
- /**
- * @deprecated use {@link #getHeaders()}
- */
- @Override
- @Deprecated
- public Header[] getAllHeaders() {
- return getHeaders();
- }
-
@Override
public Header[] getHeaders() {
return response.getHeaders();
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProxyClient.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProxyClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProxyClient.java
index f47c2df..5088cf4 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProxyClient.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProxyClient.java
@@ -146,7 +146,7 @@ public class ProxyClient {
Args.notNull(credentials, "Credentials");
HttpHost host = target;
if (host.getPort() <= 0) {
- host = new HttpHost(host.getHostName(), 80, host.getSchemeName());
+ host = new HttpHost(host.getSchemeName(), host.getHostName(), 80);
}
final HttpRoute route = new HttpRoute(
host,
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultManagedHttpClientConnection.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultManagedHttpClientConnection.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultManagedHttpClientConnection.java
index 6cb5dd6..19a4a1b 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultManagedHttpClientConnection.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultManagedHttpClientConnection.java
@@ -99,7 +99,7 @@ final class DefaultManagedHttpClientConnection
throw new InterruptedIOException("Connection already shutdown");
}
super.bind(socketHolder);
- socketTimeout = Timeout.ofMillis(socketHolder.getSocket().getSoTimeout());
+ socketTimeout = Timeout.ofMilliseconds(socketHolder.getSocket().getSoTimeout());
}
@Override
@@ -149,7 +149,7 @@ final class DefaultManagedHttpClientConnection
@Override
public void bind(final Socket socket) throws IOException {
super.bind(this.wireLog.isDebugEnabled() ? new LoggingSocketHolder(socket, this.id, this.wireLog) : new SocketHolder(socket));
- socketTimeout = Timeout.ofMillis(socket.getSoTimeout());
+ socketTimeout = Timeout.ofMilliseconds(socket.getSoTimeout());
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/impl/routing/SystemDefaultRoutePlanner.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/routing/SystemDefaultRoutePlanner.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/routing/SystemDefaultRoutePlanner.java
index 1b0b957..b62cb77 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/routing/SystemDefaultRoutePlanner.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/routing/SystemDefaultRoutePlanner.java
@@ -97,7 +97,7 @@ public class SystemDefaultRoutePlanner extends DefaultRoutePlanner {
}
final InetSocketAddress isa = (InetSocketAddress) p.address();
// assume default scheme (http)
- result = new HttpHost(isa.getAddress(), isa.getHostString(), isa.getPort(), null);
+ result = new HttpHost(null, isa.getAddress(), isa.getHostString(), isa.getPort());
}
return result;
http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/b4520067/httpclient5/src/main/java/org/apache/hc/client5/http/protocol/RequestAuthCache.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/protocol/RequestAuthCache.java b/httpclient5/src/main/java/org/apache/hc/client5/http/protocol/RequestAuthCache.java
index b9b29d2..bddaf92 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/protocol/RequestAuthCache.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/protocol/RequestAuthCache.java
@@ -93,9 +93,9 @@ public class RequestAuthCache implements HttpRequestInterceptor {
final HttpHost target;
if (authority != null) {
target = new HttpHost(
+ request.getScheme(),
authority.getHostName(),
- authority.getPort() >= 0 ? authority.getPort() : route.getTargetHost().getPort(),
- request.getScheme());
+ authority.getPort() >= 0 ? authority.getPort() : route.getTargetHost().getPort());
} else {
target = route.getTargetHost();
}