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 2020/01/07 14:26:07 UTC
[httpcomponents-client] 01/01: Upgraded HttpCore to version
5.0-beta11
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch httpcore-upgrade
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git
commit e01c2c06423dc4b711b398dc1db4f83864c5a2d9
Author: Ryan Schmitt <rs...@apache.org>
AuthorDate: Wed Dec 11 15:11:29 2019 -0800
Upgraded HttpCore to version 5.0-beta11
---
.../http/impl/cache/BasicHttpAsyncCache.java | 6 +--
.../hc/client5/http/impl/cache/BasicHttpCache.java | 6 +--
.../impl/cache/DefaultAsyncCacheRevalidator.java | 2 +-
.../ExponentialBackOffSchedulingStrategy.java | 4 +-
.../hc/client5/http/cache/TestHttpCacheEntry.java | 6 +--
.../org/apache/hc/client5/http/fluent/Request.java | 4 +-
.../async/AbstractHttpAsyncFundamentalsTest.java | 6 +--
.../TestHttp1AsyncStatefulConnManagement.java | 2 +-
.../testing/async/TestHttpAsyncMinimal.java | 4 +-
.../CachingHttpAsyncClientCompatibilityTest.java | 2 +-
.../CachingHttpClientCompatibilityTest.java | 2 +-
.../external/HttpAsyncClientCompatibilityTest.java | 10 ++--
.../external/HttpClientCompatibilityTest.java | 10 ++--
.../client5/testing/sync/LocalServerTestBase.java | 12 ++++-
.../testing/sync/TestConnectionManagement.java | 22 ++++-----
.../testing/sync/TestStatefulConnManagement.java | 2 +-
.../client5/http/async/methods/HttpRequests.java | 34 ++++++-------
.../http/async/methods/SimpleHttpRequest.java | 6 +--
.../http/async/methods/SimpleHttpRequests.java | 34 ++++++-------
.../impl/DefaultConnectionKeepAliveStrategy.java | 2 +-
.../http/impl/DefaultHttpRequestRetryStrategy.java | 4 +-
.../client5/http/impl/IdleConnectionEvictor.java | 2 +-
.../client5/http/impl/async/AsyncProtocolExec.java | 4 +-
.../client5/http/impl/async/AsyncRedirectExec.java | 6 +--
.../impl/async/InternalHttpAsyncExecRuntime.java | 2 +-
.../client5/http/impl/async/LoggingIOSession.java | 2 +-
.../http/impl/async/MinimalHttpAsyncClient.java | 2 +-
.../http/impl/classic/AIMDBackoffManager.java | 6 +--
.../http/impl/classic/InternalExecRuntime.java | 2 +-
.../http/impl/classic/MinimalHttpClient.java | 2 +-
.../hc/client5/http/impl/classic/ProtocolExec.java | 4 +-
.../hc/client5/http/impl/classic/RedirectExec.java | 4 +-
.../impl/io/BasicHttpClientConnectionManager.java | 4 +-
.../io/DefaultHttpClientConnectionOperator.java | 4 +-
.../io/PoolingHttpClientConnectionManager.java | 4 +-
.../PoolingHttpClientConnectionManagerBuilder.java | 2 +-
.../nio/PoolingAsyncClientConnectionManager.java | 4 +-
.../http/socket/PlainConnectionSocketFactory.java | 2 +-
.../http/ssl/AbstractClientTlsStrategy.java | 4 +-
.../client5/http/ssl/ClientTlsStrategyBuilder.java | 2 +-
.../http/ssl/SSLConnectionSocketFactory.java | 4 +-
.../ssl/SSLConnectionSocketFactoryBuilder.java | 2 +-
.../hc/client5/http/cookie/TestCookieOrigin.java | 4 +-
.../http/examples/AsyncClientH2ServerPush.java | 4 +-
.../examples/AsyncClientHttpExchangeStreaming.java | 4 +-
.../client5/http/examples/ClientExecuteSOCKS.java | 2 +-
.../http/impl/TestAuthenticationStrategy.java | 12 ++---
.../impl/TestDefaultConnKeepAliveStrategy.java | 8 ++--
.../http/impl/TestDefaultRedirectStrategy.java | 20 ++++----
.../client5/http/impl/auth/TestBasicAuthCache.java | 2 +-
.../client5/http/impl/auth/TestDigestScheme.java | 12 ++---
.../http/impl/auth/TestRequestAuthCache.java | 4 +-
.../impl/classic/TestContentCompressionExec.java | 20 ++++----
.../http/impl/cookie/TestBasicClientCookie.java | 4 +-
.../impl/cookie/TestBasicCookieAttribHandlers.java | 56 +++++++++++-----------
.../impl/cookie/TestLaxCookieAttribHandlers.java | 4 +-
.../io/TestBasicHttpClientConnectionManager.java | 12 ++---
.../io/TestPoolingHttpClientConnectionManager.java | 22 ++++-----
.../http/impl/routing/TestRouteDirector.java | 2 +-
.../http/impl/routing/TestRouteTracker.java | 10 ++--
.../http/protocol/TestRequestAddCookies.java | 4 +-
.../protocol/TestRequestClientConnControl.java | 2 +-
.../http/protocol/TestRequestDefaultHeaders.java | 2 +-
.../http/protocol/TestRequestExpectContinue.java | 4 +-
.../http/protocol/TestResponseProcessCookies.java | 4 +-
.../hc/client5/http/routing/TestHttpRoute.java | 4 +-
.../hc/client5/http/utils/TestDateUtils.java | 12 ++---
pom.xml | 2 +-
68 files changed, 246 insertions(+), 238 deletions(-)
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicHttpAsyncCache.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicHttpAsyncCache.java
index 9494d2f..0d8d53c 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicHttpAsyncCache.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicHttpAsyncCache.java
@@ -47,7 +47,7 @@ import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
-import org.apache.hc.core5.http.Methods;
+import org.apache.hc.core5.http.Method;
import org.apache.hc.core5.http.message.RequestLine;
import org.apache.hc.core5.http.message.StatusLine;
import org.apache.hc.core5.util.ByteArrayBuffer;
@@ -100,7 +100,7 @@ class BasicHttpAsyncCache implements HttpAsyncCache {
if (log.isDebugEnabled()) {
log.debug("Flush cache entries: " + host + "; " + new RequestLine(request));
}
- if (!Methods.isSafe(request.getMethod())) {
+ if (!Method.isSafe(request.getMethod())) {
final String cacheKey = cacheKeyGenerator.generateKey(host, request);
return storage.removeEntry(cacheKey, new FutureCallback<Boolean>() {
@@ -147,7 +147,7 @@ class BasicHttpAsyncCache implements HttpAsyncCache {
if (log.isDebugEnabled()) {
log.debug("Flush cache entries invalidated by exchange: " + host + "; " + new RequestLine(request) + " -> " + new StatusLine(response));
}
- if (!Methods.isSafe(request.getMethod())) {
+ if (!Method.isSafe(request.getMethod())) {
return cacheInvalidator.flushCacheEntriesInvalidatedByExchange(host, request, response, cacheKeyGenerator, storage, callback);
}
callback.completed(Boolean.TRUE);
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicHttpCache.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicHttpCache.java
index 14b3638..8a01a9f 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicHttpCache.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicHttpCache.java
@@ -42,7 +42,7 @@ import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
-import org.apache.hc.core5.http.Methods;
+import org.apache.hc.core5.http.Method;
import org.apache.hc.core5.http.message.RequestLine;
import org.apache.hc.core5.http.message.StatusLine;
import org.apache.hc.core5.util.ByteArrayBuffer;
@@ -102,7 +102,7 @@ class BasicHttpCache implements HttpCache {
if (log.isDebugEnabled()) {
log.debug("Flush cache entries: " + host + "; " + new RequestLine(request));
}
- if (!Methods.isSafe(request.getMethod())) {
+ if (!Method.isSafe(request.getMethod())) {
final String cacheKey = cacheKeyGenerator.generateKey(host, request);
try {
storage.removeEntry(cacheKey);
@@ -127,7 +127,7 @@ class BasicHttpCache implements HttpCache {
if (log.isDebugEnabled()) {
log.debug("Flush cache entries invalidated by exchange: " + host + "; " + new RequestLine(request) + " -> " + new StatusLine(response));
}
- if (!Methods.isSafe(request.getMethod())) {
+ if (!Method.isSafe(request.getMethod())) {
cacheInvalidator.flushCacheEntriesInvalidatedByExchange(host, request, response, cacheKeyGenerator, storage);
}
}
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/DefaultAsyncCacheRevalidator.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/DefaultAsyncCacheRevalidator.java
index 5468cec..255622d 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/DefaultAsyncCacheRevalidator.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/DefaultAsyncCacheRevalidator.java
@@ -64,7 +64,7 @@ class DefaultAsyncCacheRevalidator extends CacheRevalidatorBase {
@Override
public Future<?> schedule(final Runnable command, final TimeValue timeValue) throws RejectedExecutionException {
- if (timeValue.toMillis() <= 0) {
+ if (timeValue.toMilliseconds() <= 0) {
command.run();
return new Operations.CompletedFuture<Void>(null);
}
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 af70789..29629e1 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
@@ -108,8 +108,8 @@ public class ExponentialBackOffSchedulingStrategy implements SchedulingStrategy
protected TimeValue calculateDelay(final int consecutiveFailedAttempts) {
if (consecutiveFailedAttempts > 0) {
- final long delay = (long) (initialExpiry.toMillis() * Math.pow(backOffRate, consecutiveFailedAttempts - 1));
- return TimeValue.ofMilliseconds(Math.min(delay, maxExpiry.toMillis()));
+ final long delay = (long) (initialExpiry.toMilliseconds() * Math.pow(backOffRate, consecutiveFailedAttempts - 1));
+ return TimeValue.ofMilliseconds(Math.min(delay, maxExpiry.toMilliseconds()));
}
return TimeValue.ZERO_MILLISECONDS;
}
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/cache/TestHttpCacheEntry.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/cache/TestHttpCacheEntry.java
index bfeca36..88b8cbc 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/cache/TestHttpCacheEntry.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/cache/TestHttpCacheEntry.java
@@ -142,7 +142,7 @@ public class TestHttpCacheEntry {
try {
new HttpCacheEntry(null, new Date(), HttpStatus.SC_OK, new Header[]{}, mockResource);
fail("Should have thrown exception");
- } catch (final IllegalArgumentException expected) {
+ } catch (final NullPointerException expected) {
}
}
@@ -152,7 +152,7 @@ public class TestHttpCacheEntry {
try {
new HttpCacheEntry(new Date(), null, HttpStatus.SC_OK, new Header[]{}, mockResource);
fail("Should have thrown exception");
- } catch (final IllegalArgumentException expected) {
+ } catch (final NullPointerException expected) {
}
}
@@ -162,7 +162,7 @@ public class TestHttpCacheEntry {
try {
new HttpCacheEntry(new Date(), new Date(), HttpStatus.SC_OK, null, mockResource);
fail("Should have thrown exception");
- } catch (final IllegalArgumentException expected) {
+ } catch (final NullPointerException expected) {
}
}
diff --git a/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java b/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java
index 339abee..dee0a9a 100644
--- a/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java
+++ b/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java
@@ -55,7 +55,7 @@ import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.HttpHeaders;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpVersion;
-import org.apache.hc.core5.http.Methods;
+import org.apache.hc.core5.http.Method;
import org.apache.hc.core5.http.NameValuePair;
import org.apache.hc.core5.http.io.entity.ByteArrayEntity;
import org.apache.hc.core5.http.io.entity.FileEntity;
@@ -81,7 +81,7 @@ public class Request {
private SimpleDateFormat dateFormatter;
- public static Request create(final Methods method, final URI uri) {
+ public static Request create(final Method method, final URI uri) {
return new Request(new HttpUriRequestBase(method.name(), uri));
}
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java
index 33a47f2..4c8882e 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java
@@ -45,7 +45,7 @@ import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.Message;
-import org.apache.hc.core5.http.Methods;
+import org.apache.hc.core5.http.Method;
import org.apache.hc.core5.http.URIScheme;
import org.apache.hc.core5.http.nio.entity.AsyncEntityProducers;
import org.apache.hc.core5.http.nio.entity.BasicAsyncEntityConsumer;
@@ -98,7 +98,7 @@ public abstract class AbstractHttpAsyncFundamentalsTest<T extends CloseableHttpA
final Random rnd = new Random(System.currentTimeMillis());
rnd.nextBytes(b1);
final Future<Message<HttpResponse, byte[]>> future = httpclient.execute(
- new BasicRequestProducer(Methods.GET, target, "/echo/",
+ new BasicRequestProducer(Method.GET, target, "/echo/",
AsyncEntityProducers.create(b1, ContentType.APPLICATION_OCTET_STREAM)),
new BasicResponseConsumer<>(new BasicAsyncEntityConsumer()), HttpClientContext.create(), null);
final Message<HttpResponse, byte[]> responseMessage = future.get();
@@ -122,7 +122,7 @@ public abstract class AbstractHttpAsyncFundamentalsTest<T extends CloseableHttpA
final Queue<Future<Message<HttpResponse, byte[]>>> queue = new LinkedList<>();
for (int i = 0; i < reqCount; i++) {
final Future<Message<HttpResponse, byte[]>> future = httpclient.execute(
- new BasicRequestProducer(Methods.POST, target, "/echo/",
+ new BasicRequestProducer(Method.POST, target, "/echo/",
AsyncEntityProducers.create(b1, ContentType.APPLICATION_OCTET_STREAM)),
new BasicResponseConsumer<>(new BasicAsyncEntityConsumer()), HttpClientContext.create(), null);
queue.add(future);
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 32c68e9..553dcb9 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
@@ -157,7 +157,7 @@ public class TestHttp1AsyncStatefulConnManagement extends AbstractIntegrationTes
worker.start();
}
for (final HttpWorker worker : workers) {
- worker.join(LONG_TIMEOUT.toMillis());
+ worker.join(LONG_TIMEOUT.toMilliseconds());
}
for (final HttpWorker worker : workers) {
final Exception ex = worker.getException();
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttpAsyncMinimal.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttpAsyncMinimal.java
index 23eb5f0..377d410 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttpAsyncMinimal.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttpAsyncMinimal.java
@@ -46,7 +46,7 @@ import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.HttpVersion;
import org.apache.hc.core5.http.Message;
-import org.apache.hc.core5.http.Methods;
+import org.apache.hc.core5.http.Method;
import org.apache.hc.core5.http.URIScheme;
import org.apache.hc.core5.http.config.Http1Config;
import org.apache.hc.core5.http.nio.AsyncClientEndpoint;
@@ -124,7 +124,7 @@ public class TestHttpAsyncMinimal extends AbstractHttpAsyncFundamentalsTest<Mini
final Queue<Future<Message<HttpResponse, byte[]>>> queue = new LinkedList<>();
for (int i = 0; i < reqCount; i++) {
final Future<Message<HttpResponse, byte[]>> future = endpoint.execute(
- new BasicRequestProducer(Methods.GET, target, "/echo/",
+ new BasicRequestProducer(Method.GET, target, "/echo/",
AsyncEntityProducers.create(b1, ContentType.APPLICATION_OCTET_STREAM)),
new BasicResponseConsumer<>(new BasicAsyncEntityConsumer()), HttpClientContext.create(), null);
queue.add(future);
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 7262f88..4f65936 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
@@ -150,7 +150,7 @@ public class CachingHttpAsyncClientCompatibilityTest {
}
// GET with links
{
- connManager.closeIdle(TimeValue.NEG_ONE_MILLISECONDS);
+ connManager.closeIdle(TimeValue.NEG_ONE_MILLISECOND);
final HttpCacheContext context = HttpCacheContext.create();
final Pattern linkPattern = Pattern.compile("^<(.*)>;rel=preload$");
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 6c248b2..4f8654f 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
@@ -132,7 +132,7 @@ public class CachingHttpClientCompatibilityTest {
}
// GET with links
{
- connManager.closeIdle(TimeValue.NEG_ONE_MILLISECONDS);
+ connManager.closeIdle(TimeValue.NEG_ONE_MILLISECOND);
final HttpCacheContext context = HttpCacheContext.create();
final Pattern linkPattern = Pattern.compile("^<(.*)>;rel=preload$");
final List<String> links = new ArrayList<>();
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 7132afb..93d854c 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
@@ -187,7 +187,7 @@ public class HttpAsyncClientCompatibilityTest {
}
// Basic GET requests
{
- connManager.closeIdle(TimeValue.NEG_ONE_MILLISECONDS);
+ connManager.closeIdle(TimeValue.NEG_ONE_MILLISECOND);
final HttpClientContext context = HttpClientContext.create();
context.setCredentialsProvider(credentialsProvider);
@@ -213,7 +213,7 @@ public class HttpAsyncClientCompatibilityTest {
}
// Wrong target auth scope
{
- connManager.closeIdle(TimeValue.NEG_ONE_MILLISECONDS);
+ connManager.closeIdle(TimeValue.NEG_ONE_MILLISECOND);
credentialsProvider.setCredentials(
new AuthScope("http", "otherhost", -1, "Restricted Files", null),
new UsernamePasswordCredentials("testuser", "nopassword".toCharArray()));
@@ -239,7 +239,7 @@ public class HttpAsyncClientCompatibilityTest {
}
// Wrong target credentials
{
- connManager.closeIdle(TimeValue.NEG_ONE_MILLISECONDS);
+ connManager.closeIdle(TimeValue.NEG_ONE_MILLISECOND);
credentialsProvider.setCredentials(
new AuthScope(target),
new UsernamePasswordCredentials("testuser", "wrong password".toCharArray()));
@@ -265,7 +265,7 @@ public class HttpAsyncClientCompatibilityTest {
}
// Correct target credentials
{
- connManager.closeIdle(TimeValue.NEG_ONE_MILLISECONDS);
+ connManager.closeIdle(TimeValue.NEG_ONE_MILLISECOND);
credentialsProvider.setCredentials(
new AuthScope(target),
new UsernamePasswordCredentials("testuser", "nopassword".toCharArray()));
@@ -292,7 +292,7 @@ public class HttpAsyncClientCompatibilityTest {
// Correct target credentials (no keep-alive)
if (protocolVersion.lessEquals(HttpVersion.HTTP_1_1))
{
- connManager.closeIdle(TimeValue.NEG_ONE_MILLISECONDS);
+ connManager.closeIdle(TimeValue.NEG_ONE_MILLISECOND);
credentialsProvider.setCredentials(
new AuthScope(target),
new UsernamePasswordCredentials("testuser", "nopassword".toCharArray()));
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 e1f3f8b..ca8eaef 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
@@ -157,7 +157,7 @@ public class HttpClientCompatibilityTest {
}
// Basic GET requests
{
- connManager.closeIdle(TimeValue.NEG_ONE_MILLISECONDS);
+ connManager.closeIdle(TimeValue.NEG_ONE_MILLISECOND);
final HttpClientContext context = HttpClientContext.create();
context.setCredentialsProvider(credentialsProvider);
final String[] requestUris = new String[] {"/", "/news.html", "/status.html"};
@@ -178,7 +178,7 @@ public class HttpClientCompatibilityTest {
}
// Wrong target auth scope
{
- connManager.closeIdle(TimeValue.NEG_ONE_MILLISECONDS);
+ connManager.closeIdle(TimeValue.NEG_ONE_MILLISECOND);
credentialsProvider.setCredentials(
new AuthScope("http", "otherhost", -1, "Restricted Files", null),
new UsernamePasswordCredentials("testuser", "nopassword".toCharArray()));
@@ -200,7 +200,7 @@ public class HttpClientCompatibilityTest {
}
// Wrong target credentials
{
- connManager.closeIdle(TimeValue.NEG_ONE_MILLISECONDS);
+ connManager.closeIdle(TimeValue.NEG_ONE_MILLISECOND);
credentialsProvider.setCredentials(
new AuthScope(target),
new UsernamePasswordCredentials("testuser", "wrong password".toCharArray()));
@@ -222,7 +222,7 @@ public class HttpClientCompatibilityTest {
}
// Correct target credentials
{
- connManager.closeIdle(TimeValue.NEG_ONE_MILLISECONDS);
+ connManager.closeIdle(TimeValue.NEG_ONE_MILLISECOND);
credentialsProvider.setCredentials(
new AuthScope(target),
new UsernamePasswordCredentials("testuser", "nopassword".toCharArray()));
@@ -244,7 +244,7 @@ public class HttpClientCompatibilityTest {
}
// Correct target credentials (no keep-alive)
{
- connManager.closeIdle(TimeValue.NEG_ONE_MILLISECONDS);
+ connManager.closeIdle(TimeValue.NEG_ONE_MILLISECOND);
credentialsProvider.setCredentials(
new AuthScope(target),
new UsernamePasswordCredentials("testuser", "nopassword".toCharArray()));
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 d0cda8b..07a98b5 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
@@ -39,6 +39,7 @@ import org.apache.hc.client5.testing.classic.RandomHandler;
import org.apache.hc.core5.function.Decorator;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.URIScheme;
+import org.apache.hc.core5.http.config.Http1Config;
import org.apache.hc.core5.http.io.HttpServerRequestHandler;
import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.protocol.HttpProcessor;
@@ -126,9 +127,10 @@ public abstract class LocalServerTestBase {
};
public HttpHost start(
+ final Http1Config http1Config,
final HttpProcessor httpProcessor,
final Decorator<HttpServerRequestHandler> handlerDecorator) throws IOException {
- this.server.start(httpProcessor, handlerDecorator);
+ this.server.start(http1Config, httpProcessor, handlerDecorator);
if (this.httpclient == null) {
this.httpclient = this.clientBuilder.build();
@@ -137,8 +139,14 @@ public abstract class LocalServerTestBase {
return new HttpHost(this.scheme.name(), "localhost", this.server.getPort());
}
+ public HttpHost start(
+ final HttpProcessor httpProcessor,
+ final Decorator<HttpServerRequestHandler> handlerDecorator) throws IOException {
+ return start(null, httpProcessor, handlerDecorator);
+ }
+
public HttpHost start() throws Exception {
- return start(null, null);
+ return start(null, null, null);
}
}
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 a0fbc9f..3dd7598 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
@@ -82,7 +82,7 @@ public class TestConnectionManagement extends LocalServerTestBase {
final LeaseRequest leaseRequest1 = this.connManager.lease("id1", route,null);
final ConnectionEndpoint endpoint1 = leaseRequest1.get(Timeout.ZERO_MILLISECONDS);
- this.connManager.connect(endpoint1, TimeValue.NEG_ONE_MILLISECONDS, context);
+ this.connManager.connect(endpoint1, TimeValue.NEG_ONE_MILLISECOND, context);
final HttpProcessor httpProcessor = new DefaultHttpProcessor(
new RequestTargetHost(), new RequestContent(), new RequestConnControl());
@@ -104,12 +104,12 @@ public class TestConnectionManagement extends LocalServerTestBase {
}
endpoint1.close();
- this.connManager.release(endpoint1, null, TimeValue.NEG_ONE_MILLISECONDS);
+ this.connManager.release(endpoint1, null, TimeValue.NEG_ONE_MILLISECOND);
final LeaseRequest leaseRequest2 = this.connManager.lease("id2", route,null);
final ConnectionEndpoint endpoint2 = leaseRequest2.get(Timeout.ZERO_MILLISECONDS);
Assert.assertFalse(endpoint2.isConnected());
- this.connManager.connect(endpoint2, TimeValue.NEG_ONE_MILLISECONDS, context);
+ this.connManager.connect(endpoint2, TimeValue.NEG_ONE_MILLISECOND, context);
try (final ClassicHttpResponse response2 = endpoint2.execute("id2", request, exec, context)) {
Assert.assertEquals(HttpStatus.SC_OK, response2.getCode());
@@ -117,7 +117,7 @@ public class TestConnectionManagement extends LocalServerTestBase {
// release connection after marking it for re-use
// expect the next connection obtained to be open
- this.connManager.release(endpoint2, null, TimeValue.NEG_ONE_MILLISECONDS);
+ this.connManager.release(endpoint2, null, TimeValue.NEG_ONE_MILLISECOND);
final LeaseRequest leaseRequest3 = this.connManager.lease("id3", route,null);
final ConnectionEndpoint endpoint3 = leaseRequest3.get(Timeout.ZERO_MILLISECONDS);
@@ -128,7 +128,7 @@ public class TestConnectionManagement extends LocalServerTestBase {
Assert.assertEquals(HttpStatus.SC_OK, response3.getCode());
}
- this.connManager.release(endpoint3, null, TimeValue.NEG_ONE_MILLISECONDS);
+ this.connManager.release(endpoint3, null, TimeValue.NEG_ONE_MILLISECOND);
this.connManager.close();
}
@@ -150,7 +150,7 @@ public class TestConnectionManagement extends LocalServerTestBase {
final LeaseRequest leaseRequest1 = this.connManager.lease("id1", route,null);
final ConnectionEndpoint endpoint1 = leaseRequest1.get(Timeout.ZERO_MILLISECONDS);
- this.connManager.connect(endpoint1, TimeValue.NEG_ONE_MILLISECONDS, context);
+ this.connManager.connect(endpoint1, TimeValue.NEG_ONE_MILLISECOND, context);
final HttpProcessor httpProcessor = new DefaultHttpProcessor(
new RequestTargetHost(), new RequestContent(), new RequestConnControl());
@@ -178,7 +178,7 @@ public class TestConnectionManagement extends LocalServerTestBase {
final ConnectionEndpoint endpoint2 = leaseRequest2.get(Timeout.ZERO_MILLISECONDS);
Assert.assertFalse(endpoint2.isConnected());
- this.connManager.connect(endpoint2, TimeValue.NEG_ONE_MILLISECONDS, context);
+ this.connManager.connect(endpoint2, TimeValue.NEG_ONE_MILLISECOND, context);
try (final ClassicHttpResponse response2 = endpoint2.execute("id2", request, exec, context)) {
Assert.assertEquals(HttpStatus.SC_OK, response2.getCode());
@@ -203,7 +203,7 @@ public class TestConnectionManagement extends LocalServerTestBase {
Assert.assertFalse(endpoint4.isConnected());
// repeat the communication, no need to prepare the request again
- this.connManager.connect(endpoint4, TimeValue.NEG_ONE_MILLISECONDS, context);
+ this.connManager.connect(endpoint4, TimeValue.NEG_ONE_MILLISECOND, context);
try (final ClassicHttpResponse response4 = endpoint4.execute("id4", request, exec, context)) {
Assert.assertEquals(HttpStatus.SC_OK, response4.getCode());
@@ -223,7 +223,7 @@ public class TestConnectionManagement extends LocalServerTestBase {
final LeaseRequest leaseRequest1 = this.connManager.lease("id1", route,null);
final ConnectionEndpoint endpoint1 = leaseRequest1.get(Timeout.ZERO_MILLISECONDS);
- this.connManager.connect(endpoint1, TimeValue.NEG_ONE_MILLISECONDS, context);
+ this.connManager.connect(endpoint1, TimeValue.NEG_ONE_MILLISECOND, context);
Assert.assertEquals(1, this.connManager.getTotalStats().getLeased());
Assert.assertEquals(1, this.connManager.getStats(route).getLeased());
@@ -272,12 +272,12 @@ public class TestConnectionManagement extends LocalServerTestBase {
final LeaseRequest leaseRequest1 = this.connManager.lease("id1", route,null);
final ConnectionEndpoint endpoint1 = leaseRequest1.get(Timeout.ZERO_MILLISECONDS);
- this.connManager.connect(endpoint1, TimeValue.NEG_ONE_MILLISECONDS, context);
+ this.connManager.connect(endpoint1, TimeValue.NEG_ONE_MILLISECOND, context);
Assert.assertEquals(1, this.connManager.getTotalStats().getLeased());
Assert.assertEquals(1, this.connManager.getStats(route).getLeased());
// Release, let remain idle for forever
- this.connManager.release(endpoint1, null, TimeValue.NEG_ONE_MILLISECONDS);
+ this.connManager.release(endpoint1, null, TimeValue.NEG_ONE_MILLISECOND);
// Released, still active.
Assert.assertEquals(1, this.connManager.getTotalStats().getAvailable());
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestStatefulConnManagement.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestStatefulConnManagement.java
index cadf768..418550f 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestStatefulConnManagement.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestStatefulConnManagement.java
@@ -107,7 +107,7 @@ public class TestStatefulConnManagement extends LocalServerTestBase {
worker.start();
}
for (final HttpWorker worker : workers) {
- worker.join(LONG_TIMEOUT.toMillis());
+ worker.join(LONG_TIMEOUT.toMilliseconds());
}
for (final HttpWorker worker : workers) {
final Exception ex = worker.getException();
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/HttpRequests.java b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/HttpRequests.java
index 436eee8..46e3779 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/HttpRequests.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/HttpRequests.java
@@ -30,7 +30,7 @@ package org.apache.hc.client5.http.async.methods;
import java.net.URI;
import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.http.Methods;
+import org.apache.hc.core5.http.Method;
import org.apache.hc.core5.http.message.BasicHttpRequest;
/**
@@ -43,96 +43,96 @@ public enum HttpRequests {
DELETE {
@Override
public BasicHttpRequest create(final URI uri) {
- return new BasicHttpRequest(Methods.DELETE, uri);
+ return new BasicHttpRequest(Method.DELETE, uri);
}
@Override
public BasicHttpRequest create(final HttpHost host, final String path) {
- return new BasicHttpRequest(Methods.DELETE, host, path);
+ return new BasicHttpRequest(Method.DELETE, host, path);
}
},
GET {
@Override
public BasicHttpRequest create(final URI uri) {
- return new BasicHttpRequest(Methods.GET, uri);
+ return new BasicHttpRequest(Method.GET, uri);
}
@Override
public BasicHttpRequest create(final HttpHost host, final String path) {
- return new BasicHttpRequest(Methods.GET, host, path);
+ return new BasicHttpRequest(Method.GET, host, path);
}
},
HEAD {
@Override
public BasicHttpRequest create(final URI uri) {
- return new BasicHttpRequest(Methods.HEAD, uri);
+ return new BasicHttpRequest(Method.HEAD, uri);
}
@Override
public BasicHttpRequest create(final HttpHost host, final String path) {
- return new BasicHttpRequest(Methods.HEAD, host, path);
+ return new BasicHttpRequest(Method.HEAD, host, path);
}
},
OPTIONS {
@Override
public BasicHttpRequest create(final URI uri) {
- return new BasicHttpRequest(Methods.OPTIONS, uri);
+ return new BasicHttpRequest(Method.OPTIONS, uri);
}
@Override
public BasicHttpRequest create(final HttpHost host, final String path) {
- return new BasicHttpRequest(Methods.OPTIONS, host, path);
+ return new BasicHttpRequest(Method.OPTIONS, host, path);
}
},
PATCH {
@Override
public BasicHttpRequest create(final URI uri) {
- return new BasicHttpRequest(Methods.PATCH, uri);
+ return new BasicHttpRequest(Method.PATCH, uri);
}
@Override
public BasicHttpRequest create(final HttpHost host, final String path) {
- return new BasicHttpRequest(Methods.PATCH, host, path);
+ return new BasicHttpRequest(Method.PATCH, host, path);
}
},
POST {
@Override
public BasicHttpRequest create(final URI uri) {
- return new BasicHttpRequest(Methods.POST, uri);
+ return new BasicHttpRequest(Method.POST, uri);
}
@Override
public BasicHttpRequest create(final HttpHost host, final String path) {
- return new BasicHttpRequest(Methods.POST, host, path);
+ return new BasicHttpRequest(Method.POST, host, path);
}
},
PUT {
@Override
public BasicHttpRequest create(final URI uri) {
- return new BasicHttpRequest(Methods.PUT, uri);
+ return new BasicHttpRequest(Method.PUT, uri);
}
@Override
public BasicHttpRequest create(final HttpHost host, final String path) {
- return new BasicHttpRequest(Methods.PUT, host, path);
+ return new BasicHttpRequest(Method.PUT, host, path);
}
},
TRACE {
@Override
public BasicHttpRequest create(final URI uri) {
- return new BasicHttpRequest(Methods.TRACE, uri);
+ return new BasicHttpRequest(Method.TRACE, uri);
}
@Override
public BasicHttpRequest create(final HttpHost host, final String path) {
- return new BasicHttpRequest(Methods.TRACE, host, path);
+ return new BasicHttpRequest(Method.TRACE, host, path);
}
};
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpRequest.java b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpRequest.java
index efb63de..aad4a85 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpRequest.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpRequest.java
@@ -34,7 +34,7 @@ import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpRequest;
-import org.apache.hc.core5.http.Methods;
+import org.apache.hc.core5.http.Method;
import org.apache.hc.core5.util.Args;
/**
@@ -73,11 +73,11 @@ public final class SimpleHttpRequest extends ConfigurableHttpRequest {
super(method, requestUri);
}
- SimpleHttpRequest(final Methods method, final URI requestUri) {
+ SimpleHttpRequest(final Method method, final URI requestUri) {
this(method.name(), requestUri);
}
- SimpleHttpRequest(final Methods method, final HttpHost host, final String path) {
+ SimpleHttpRequest(final Method method, final HttpHost host, final String path) {
this(method.name(), host, path);
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpRequests.java b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpRequests.java
index 13f5d7e..d04aa48 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpRequests.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpRequests.java
@@ -30,7 +30,7 @@ package org.apache.hc.client5.http.async.methods;
import java.net.URI;
import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.http.Methods;
+import org.apache.hc.core5.http.Method;
/**
* Common HTTP methods using {@link SimpleHttpRequest} as a HTTP request message representation.
@@ -42,96 +42,96 @@ public enum SimpleHttpRequests {
DELETE {
@Override
public SimpleHttpRequest create(final URI uri) {
- return new SimpleHttpRequest(Methods.DELETE, uri);
+ return new SimpleHttpRequest(Method.DELETE, uri);
}
@Override
public SimpleHttpRequest create(final HttpHost host, final String path) {
- return new SimpleHttpRequest(Methods.DELETE, host, path);
+ return new SimpleHttpRequest(Method.DELETE, host, path);
}
},
GET {
@Override
public SimpleHttpRequest create(final URI uri) {
- return new SimpleHttpRequest(Methods.GET, uri);
+ return new SimpleHttpRequest(Method.GET, uri);
}
@Override
public SimpleHttpRequest create(final HttpHost host, final String path) {
- return new SimpleHttpRequest(Methods.GET, host, path);
+ return new SimpleHttpRequest(Method.GET, host, path);
}
},
HEAD {
@Override
public SimpleHttpRequest create(final URI uri) {
- return new SimpleHttpRequest(Methods.HEAD, uri);
+ return new SimpleHttpRequest(Method.HEAD, uri);
}
@Override
public SimpleHttpRequest create(final HttpHost host, final String path) {
- return new SimpleHttpRequest(Methods.HEAD, host, path);
+ return new SimpleHttpRequest(Method.HEAD, host, path);
}
},
OPTIONS {
@Override
public SimpleHttpRequest create(final URI uri) {
- return new SimpleHttpRequest(Methods.OPTIONS, uri);
+ return new SimpleHttpRequest(Method.OPTIONS, uri);
}
@Override
public SimpleHttpRequest create(final HttpHost host, final String path) {
- return new SimpleHttpRequest(Methods.OPTIONS, host, path);
+ return new SimpleHttpRequest(Method.OPTIONS, host, path);
}
},
PATCH {
@Override
public SimpleHttpRequest create(final URI uri) {
- return new SimpleHttpRequest(Methods.PATCH, uri);
+ return new SimpleHttpRequest(Method.PATCH, uri);
}
@Override
public SimpleHttpRequest create(final HttpHost host, final String path) {
- return new SimpleHttpRequest(Methods.PATCH, host, path);
+ return new SimpleHttpRequest(Method.PATCH, host, path);
}
},
POST {
@Override
public SimpleHttpRequest create(final URI uri) {
- return new SimpleHttpRequest(Methods.POST, uri);
+ return new SimpleHttpRequest(Method.POST, uri);
}
@Override
public SimpleHttpRequest create(final HttpHost host, final String path) {
- return new SimpleHttpRequest(Methods.POST, host, path);
+ return new SimpleHttpRequest(Method.POST, host, path);
}
},
PUT {
@Override
public SimpleHttpRequest create(final URI uri) {
- return new SimpleHttpRequest(Methods.PUT, uri);
+ return new SimpleHttpRequest(Method.PUT, uri);
}
@Override
public SimpleHttpRequest create(final HttpHost host, final String path) {
- return new SimpleHttpRequest(Methods.PUT, host, path);
+ return new SimpleHttpRequest(Method.PUT, host, path);
}
},
TRACE {
@Override
public SimpleHttpRequest create(final URI uri) {
- return new SimpleHttpRequest(Methods.TRACE, uri);
+ return new SimpleHttpRequest(Method.TRACE, uri);
}
@Override
public SimpleHttpRequest create(final HttpHost host, final String path) {
- return new SimpleHttpRequest(Methods.TRACE, host, path);
+ return new SimpleHttpRequest(Method.TRACE, host, path);
}
};
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultConnectionKeepAliveStrategy.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultConnectionKeepAliveStrategy.java
index 3c4c225..9be7b8e 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultConnectionKeepAliveStrategy.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultConnectionKeepAliveStrategy.java
@@ -69,7 +69,7 @@ public class DefaultConnectionKeepAliveStrategy implements ConnectionKeepAliveSt
}
}
}
- return TimeValue.NEG_ONE_MILLISECONDS;
+ return TimeValue.NEG_ONE_MILLISECOND;
}
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultHttpRequestRetryStrategy.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultHttpRequestRetryStrategy.java
index adef6bf..513ccc2 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultHttpRequestRetryStrategy.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultHttpRequestRetryStrategy.java
@@ -50,7 +50,7 @@ import org.apache.hc.core5.http.HttpHeaders;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.HttpStatus;
-import org.apache.hc.core5.http.Methods;
+import org.apache.hc.core5.http.Method;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.util.Args;
import org.apache.hc.core5.util.TimeValue;
@@ -226,7 +226,7 @@ public class DefaultHttpRequestRetryStrategy implements HttpRequestRetryStrategy
}
protected boolean handleAsIdempotent(final HttpRequest request) {
- return Methods.isIdempotent(request.getMethod());
+ return Method.isIdempotent(request.getMethod());
}
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/IdleConnectionEvictor.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/IdleConnectionEvictor.java
index 1e7258e..2950c2b 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/IdleConnectionEvictor.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/IdleConnectionEvictor.java
@@ -95,7 +95,7 @@ public final class IdleConnectionEvictor {
}
public void awaitTermination(final Timeout timeout) throws InterruptedException {
- thread.join(timeout != null ? timeout.toMillis() : Long.MAX_VALUE);
+ thread.join(timeout != null ? timeout.toMilliseconds() : Long.MAX_VALUE);
}
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncProtocolExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncProtocolExec.java
index 0f18fe1..11fd40a 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncProtocolExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncProtocolExec.java
@@ -57,7 +57,7 @@ import org.apache.hc.core5.http.HttpHeaders;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
-import org.apache.hc.core5.http.Methods;
+import org.apache.hc.core5.http.Method;
import org.apache.hc.core5.http.ProtocolException;
import org.apache.hc.core5.http.nio.AsyncDataConsumer;
import org.apache.hc.core5.http.nio.AsyncEntityProducer;
@@ -181,7 +181,7 @@ public final class AsyncProtocolExec implements AsyncExecChainHandler {
clientContext.setAttribute(HttpCoreContext.HTTP_RESPONSE, response);
httpProcessor.process(response, entityDetails, clientContext);
- if (Methods.TRACE.isSame(request.getMethod())) {
+ if (Method.TRACE.isSame(request.getMethod())) {
// Do not perform authentication for TRACE request
return asyncExecCallback.handleResponse(response, entityDetails);
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncRedirectExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncRedirectExec.java
index 53d5b7e..ef7a138 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncRedirectExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncRedirectExec.java
@@ -51,7 +51,7 @@ import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.HttpStatus;
-import org.apache.hc.core5.http.Methods;
+import org.apache.hc.core5.http.Method;
import org.apache.hc.core5.http.ProtocolException;
import org.apache.hc.core5.http.message.BasicHttpRequest;
import org.apache.hc.core5.http.nio.AsyncDataConsumer;
@@ -143,8 +143,8 @@ public final class AsyncRedirectExec implements AsyncExecChainHandler {
case HttpStatus.SC_MOVED_PERMANENTLY:
case HttpStatus.SC_MOVED_TEMPORARILY:
case HttpStatus.SC_SEE_OTHER:
- if (!Methods.isSafe(request.getMethod())) {
- state.currentRequest = new BasicHttpRequest(Methods.GET, redirectUri);
+ if (!Method.isSafe(request.getMethod())) {
+ state.currentRequest = new BasicHttpRequest(Method.GET, redirectUri);
state.currentEntityProducer = null;
}
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttpAsyncExecRuntime.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttpAsyncExecRuntime.java
index c6cb2a4..52f804f 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttpAsyncExecRuntime.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttpAsyncExecRuntime.java
@@ -75,7 +75,7 @@ class InternalHttpAsyncExecRuntime implements AsyncExecRuntime {
this.pushHandlerFactory = pushHandlerFactory;
this.versionPolicy = versionPolicy;
this.endpointRef = new AtomicReference<>(null);
- this.validDuration = TimeValue.NEG_ONE_MILLISECONDS;
+ this.validDuration = TimeValue.NEG_ONE_MILLISECOND;
}
@Override
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 7d411ed..5005b32 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
@@ -162,7 +162,7 @@ class LoggingIOSession implements IOSession {
}
@Override
- public int getStatus() {
+ public Status getStatus() {
return this.session.getStatus();
}
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 e74cf3d..65af820 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
@@ -478,7 +478,7 @@ public final class MinimalHttpAsyncClient extends AbstractMinimalHttpAsyncClient
@Override
public void releaseAndReuse() {
if (released.compareAndSet(false, true)) {
- manager.release(connectionEndpoint, null, TimeValue.NEG_ONE_MILLISECONDS);
+ manager.release(connectionEndpoint, null, TimeValue.NEG_ONE_MILLISECOND);
}
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/AIMDBackoffManager.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/AIMDBackoffManager.java
index 5220198..c22cb21 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/AIMDBackoffManager.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/AIMDBackoffManager.java
@@ -91,7 +91,7 @@ public class AIMDBackoffManager implements BackoffManager {
final int curr = connPerRoute.getMaxPerRoute(route);
final Long lastUpdate = getLastUpdate(lastRouteBackoffs, route);
final long now = clock.getCurrentTime();
- if (now - lastUpdate.longValue() < coolDown.toMillis()) {
+ if (now - lastUpdate.longValue() < coolDown.toMilliseconds()) {
return;
}
connPerRoute.setMaxPerRoute(route, getBackedOffPoolSize(curr));
@@ -114,8 +114,8 @@ public class AIMDBackoffManager implements BackoffManager {
final Long lastProbe = getLastUpdate(lastRouteProbes, route);
final Long lastBackoff = getLastUpdate(lastRouteBackoffs, route);
final long now = clock.getCurrentTime();
- if (now - lastProbe.longValue() < coolDown.toMillis()
- || now - lastBackoff.longValue() < coolDown.toMillis()) {
+ if (now - lastProbe.longValue() < coolDown.toMilliseconds()
+ || now - lastBackoff.longValue() < coolDown.toMilliseconds()) {
return;
}
connPerRoute.setMaxPerRoute(route, max);
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/InternalExecRuntime.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/InternalExecRuntime.java
index 49a9b15..7931943 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/InternalExecRuntime.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/InternalExecRuntime.java
@@ -77,7 +77,7 @@ class InternalExecRuntime implements ExecRuntime, Cancellable {
this.requestExecutor = requestExecutor;
this.cancellableDependency = cancellableDependency;
this.endpointRef = new AtomicReference<>(null);
- this.validDuration = TimeValue.NEG_ONE_MILLISECONDS;
+ this.validDuration = TimeValue.NEG_ONE_MILLISECOND;
}
@Override
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/MinimalHttpClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/MinimalHttpClient.java
index 5dfb662..3d074d5 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/MinimalHttpClient.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/MinimalHttpClient.java
@@ -150,7 +150,7 @@ public class MinimalHttpClient extends CloseableHttpClient {
httpProcessor.process(response, response.getEntity(), context);
if (reuseStrategy.keepAlive(request, response, context)) {
- execRuntime.markConnectionReusable(null, TimeValue.NEG_ONE_MILLISECONDS);
+ execRuntime.markConnectionReusable(null, TimeValue.NEG_ONE_MILLISECOND);
} else {
execRuntime.markConnectionNonReusable();
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProtocolExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProtocolExec.java
index e74b0d4..756f9bd 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProtocolExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProtocolExec.java
@@ -57,7 +57,7 @@ import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpHeaders;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpResponse;
-import org.apache.hc.core5.http.Methods;
+import org.apache.hc.core5.http.Method;
import org.apache.hc.core5.http.ProtocolException;
import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.apache.hc.core5.http.protocol.HttpCoreContext;
@@ -167,7 +167,7 @@ public final class ProtocolExec implements ExecChainHandler {
context.setAttribute(HttpCoreContext.HTTP_RESPONSE, response);
httpProcessor.process(response, response.getEntity(), context);
- if (Methods.TRACE.isSame(request.getMethod())) {
+ if (Method.TRACE.isSame(request.getMethod())) {
// Do not perform authentication for TRACE request
return response;
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/RedirectExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/RedirectExec.java
index d2503e6..bdd3219 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/RedirectExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/RedirectExec.java
@@ -52,7 +52,7 @@ import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpStatus;
-import org.apache.hc.core5.http.Methods;
+import org.apache.hc.core5.http.Method;
import org.apache.hc.core5.http.ProtocolException;
import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.apache.hc.core5.http.message.BasicClassicHttpRequest;
@@ -146,7 +146,7 @@ public final class RedirectExec implements ExecChainHandler {
case HttpStatus.SC_MOVED_PERMANENTLY:
case HttpStatus.SC_MOVED_TEMPORARILY:
case HttpStatus.SC_SEE_OTHER:
- if (!Methods.isSafe(request.getMethod())) {
+ if (!Method.isSafe(request.getMethod())) {
redirect = new HttpGet(redirectUri);
}
}
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 3eff459..eaa10e4 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
@@ -280,7 +280,7 @@ public class BasicHttpClientConnectionManager implements HttpClientConnectionMan
if (this.log.isDebugEnabled()) {
this.log.debug("Connection can be kept alive for " + keepAlive);
}
- this.expiry = this.updated + keepAlive.toMillis();
+ this.expiry = this.updated + keepAlive.toMilliseconds();
} else {
if (this.log.isDebugEnabled()) {
this.log.debug("Connection can be kept alive indefinitely");
@@ -345,7 +345,7 @@ public class BasicHttpClientConnectionManager implements HttpClientConnectionMan
return;
}
if (!this.leased) {
- long time = idleTime.toMillis();
+ long time = idleTime.toMilliseconds();
if (time < 0) {
time = 0;
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultHttpClientConnectionOperator.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultHttpClientConnectionOperator.java
index 2f0b5f2..7e9964b 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultHttpClientConnectionOperator.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultHttpClientConnectionOperator.java
@@ -123,7 +123,7 @@ public class DefaultHttpClientConnectionOperator implements HttpClientConnection
final boolean last = i == addresses.length - 1;
Socket sock = sf.createSocket(context);
- sock.setSoTimeout(socketConfig.getSoTimeout().toMillisIntBound());
+ sock.setSoTimeout(socketConfig.getSoTimeout().toMillisecondsIntBound());
sock.setReuseAddress(socketConfig.isSoReuseAddress());
sock.setTcpNoDelay(socketConfig.isTcpNoDelay());
sock.setKeepAlive(socketConfig.isSoKeepAlive());
@@ -134,7 +134,7 @@ public class DefaultHttpClientConnectionOperator implements HttpClientConnection
sock.setSendBufferSize(socketConfig.getSndBufSize());
}
- final int linger = socketConfig.getSoLinger().toMillisIntBound();
+ final int linger = socketConfig.getSoLinger().toMillisecondsIntBound();
if (linger >= 0) {
sock.setSoLinger(true, linger);
}
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 1798dba..5600f93 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
@@ -136,7 +136,7 @@ public class PoolingHttpClientConnectionManager
public PoolingHttpClientConnectionManager(
final Registry<ConnectionSocketFactory> socketFactoryRegistry,
final HttpConnectionFactory<ManagedHttpClientConnection> connFactory) {
- this(socketFactoryRegistry, PoolConcurrencyPolicy.STRICT, TimeValue.NEG_ONE_MILLISECONDS, connFactory);
+ this(socketFactoryRegistry, PoolConcurrencyPolicy.STRICT, TimeValue.NEG_ONE_MILLISECOND, connFactory);
}
public PoolingHttpClientConnectionManager(
@@ -290,7 +290,7 @@ public class PoolingHttpClientConnectionManager
if (TimeValue.isNonNegative(validateAfterInactivity)) {
final ManagedHttpClientConnection conn = poolEntry.getConnection();
if (conn != null
- && poolEntry.getUpdated() + validateAfterInactivity.toMillis() <= System.currentTimeMillis()) {
+ && poolEntry.getUpdated() + validateAfterInactivity.toMilliseconds() <= System.currentTimeMillis()) {
boolean stale;
try {
stale = conn.isStale();
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 98ea2eb..955c3e7 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
@@ -208,7 +208,7 @@ public class PoolingHttpClientConnectionManagerBuilder {
.build(),
poolConcurrencyPolicy,
poolReusePolicy,
- timeToLive != null ? timeToLive : TimeValue.NEG_ONE_MILLISECONDS,
+ timeToLive != null ? timeToLive : TimeValue.NEG_ONE_MILLISECOND,
schemePortResolver,
dnsResolver,
connectionFactory);
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 81fcfa9..9582afb 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
@@ -121,7 +121,7 @@ public class PoolingAsyncClientConnectionManager implements AsyncClientConnectio
}
public PoolingAsyncClientConnectionManager(final Lookup<TlsStrategy> tlsStrategyLookup) {
- this(tlsStrategyLookup, PoolConcurrencyPolicy.STRICT, TimeValue.NEG_ONE_MILLISECONDS);
+ this(tlsStrategyLookup, PoolConcurrencyPolicy.STRICT, TimeValue.NEG_ONE_MILLISECOND);
}
public PoolingAsyncClientConnectionManager(
@@ -246,7 +246,7 @@ public class PoolingAsyncClientConnectionManager implements AsyncClientConnectio
final ManagedAsyncClientConnection connection = poolEntry.getConnection();
final TimeValue timeValue = PoolingAsyncClientConnectionManager.this.validateAfterInactivity;
if (TimeValue.isPositive(timeValue) && connection != null &&
- poolEntry.getUpdated() + timeValue.toMillis() <= System.currentTimeMillis()) {
+ poolEntry.getUpdated() + timeValue.toMilliseconds() <= System.currentTimeMillis()) {
final ProtocolVersion protocolVersion = connection.getProtocolVersion();
if (HttpVersion.HTTP_2_0.greaterEquals(protocolVersion)) {
connection.submitCommand(new PingCommand(new BasicPingHandler(new Callback<Boolean>() {
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/socket/PlainConnectionSocketFactory.java b/httpclient5/src/main/java/org/apache/hc/client5/http/socket/PlainConnectionSocketFactory.java
index c828072..1c66bd0 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/socket/PlainConnectionSocketFactory.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/socket/PlainConnectionSocketFactory.java
@@ -84,7 +84,7 @@ public class PlainConnectionSocketFactory implements ConnectionSocketFactory {
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
@Override
public Object run() throws IOException {
- sock.connect(remoteAddress, TimeValue.isPositive(connectTimeout) ? connectTimeout.toMillisIntBound() : 0);
+ sock.connect(remoteAddress, TimeValue.isPositive(connectTimeout) ? connectTimeout.toMillisecondsIntBound() : 0);
return null;
}
});
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/AbstractClientTlsStrategy.java b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/AbstractClientTlsStrategy.java
index 72859c6..ac36438 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/AbstractClientTlsStrategy.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/AbstractClientTlsStrategy.java
@@ -45,7 +45,7 @@ import org.apache.hc.core5.http.nio.ssl.TlsStrategy;
import org.apache.hc.core5.http.ssl.TLS;
import org.apache.hc.core5.http.ssl.TlsCiphers;
import org.apache.hc.core5.http2.HttpVersionPolicy;
-import org.apache.hc.core5.http2.ssl.ApplicationProtocols;
+import org.apache.hc.core5.http2.ssl.ApplicationProtocol;
import org.apache.hc.core5.http2.ssl.H2TlsSupport;
import org.apache.hc.core5.net.NamedEndpoint;
import org.apache.hc.core5.reactor.ssl.SSLBufferMode;
@@ -134,7 +134,7 @@ abstract class AbstractClientTlsStrategy implements TlsStrategy {
verifySession(host.getHostName(), sslEngine.getSession());
final TlsDetails tlsDetails = createTlsDetails(sslEngine);
final String negotiatedCipherSuite = sslEngine.getSession().getCipherSuite();
- if (tlsDetails != null && ApplicationProtocols.HTTP_2.id.equals(tlsDetails.getApplicationProtocol())) {
+ if (tlsDetails != null && ApplicationProtocol.HTTP_2.id.equals(tlsDetails.getApplicationProtocol())) {
if (TlsCiphers.isH2Blacklisted(negotiatedCipherSuite)) {
throw new SSLHandshakeException("Cipher suite `" + negotiatedCipherSuite
+ "` does not provide adequate security for HTTP/2");
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 8b4145e..475a695 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
@@ -102,7 +102,7 @@ public class ClientTlsStrategyBuilder {
public final ClientTlsStrategyBuilder setTlsVersions(final TLS... tlslVersions) {
this.tlsVersions = new String[tlslVersions.length];
for (int i = 0; i < tlslVersions.length; i++) {
- this.tlsVersions[i] = tlslVersions[i].ident;
+ this.tlsVersions[i] = tlslVersions[i].id;
}
return this;
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactory.java b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactory.java
index d3be931..bc6d3b7 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactory.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactory.java
@@ -208,7 +208,7 @@ public class SSLConnectionSocketFactory implements LayeredConnectionSocketFactor
}
try {
if (TimeValue.isPositive(connectTimeout) && sock.getSoTimeout() == 0) {
- sock.setSoTimeout(connectTimeout.toMillisIntBound());
+ sock.setSoTimeout(connectTimeout.toMillisecondsIntBound());
}
if (this.log.isDebugEnabled()) {
this.log.debug("Connecting socket to " + remoteAddress + " with timeout " + connectTimeout);
@@ -219,7 +219,7 @@ public class SSLConnectionSocketFactory implements LayeredConnectionSocketFactor
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
@Override
public Object run() throws IOException {
- sock.connect(remoteAddress, connectTimeout != null ? connectTimeout.toMillisIntBound() : 0);
+ sock.connect(remoteAddress, connectTimeout != null ? connectTimeout.toMillisecondsIntBound() : 0);
return null;
}
});
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactoryBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactoryBuilder.java
index f31d78d..0926dce 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactoryBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactoryBuilder.java
@@ -93,7 +93,7 @@ public class SSLConnectionSocketFactoryBuilder {
public final SSLConnectionSocketFactoryBuilder setTlsVersions(final TLS... tlslVersions) {
this.tlsVersions = new String[tlslVersions.length];
for (int i = 0; i < tlslVersions.length; i++) {
- this.tlsVersions[i] = tlslVersions[i].ident;
+ this.tlsVersions[i] = tlslVersions[i].id;
}
return this;
}
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/cookie/TestCookieOrigin.java b/httpclient5/src/test/java/org/apache/hc/client5/http/cookie/TestCookieOrigin.java
index 3d528f0..ad32d1b 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/cookie/TestCookieOrigin.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/cookie/TestCookieOrigin.java
@@ -45,7 +45,7 @@ public class TestCookieOrigin {
}
@SuppressWarnings("unused")
- @Test(expected=IllegalArgumentException.class)
+ @Test(expected=NullPointerException.class)
public void testNullHost() {
new CookieOrigin(null, 80, "/", false);
}
@@ -63,7 +63,7 @@ public class TestCookieOrigin {
}
@SuppressWarnings("unused")
- @Test(expected=IllegalArgumentException.class)
+ @Test(expected=NullPointerException.class)
public void testNullPath() {
new CookieOrigin("www.apache.org", 80, null, false);
}
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientH2ServerPush.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientH2ServerPush.java
index 4a16dbc..144329e 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientH2ServerPush.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientH2ServerPush.java
@@ -41,7 +41,7 @@ import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
-import org.apache.hc.core5.http.Methods;
+import org.apache.hc.core5.http.Method;
import org.apache.hc.core5.http.message.StatusLine;
import org.apache.hc.core5.http.nio.AsyncPushConsumer;
import org.apache.hc.core5.http.nio.support.BasicRequestProducer;
@@ -118,7 +118,7 @@ public class AsyncClientH2ServerPush {
final HttpHost target = new HttpHost("nghttp2.org");
final String requestURI = "/httpbin/";
final Future<Void> future = client.execute(
- new BasicRequestProducer(Methods.GET, target, requestURI),
+ new BasicRequestProducer(Method.GET, target, requestURI),
new AbstractCharResponseConsumer<Void>() {
@Override
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java
index dc3e87b..c543bf9 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java
@@ -37,7 +37,7 @@ import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpResponse;
-import org.apache.hc.core5.http.Methods;
+import org.apache.hc.core5.http.Method;
import org.apache.hc.core5.http.message.StatusLine;
import org.apache.hc.core5.http.nio.support.BasicRequestProducer;
import org.apache.hc.core5.io.CloseMode;
@@ -66,7 +66,7 @@ public class AsyncClientHttpExchangeStreaming {
for (final String requestUri: requestUris) {
final Future<Void> future = client.execute(
- new BasicRequestProducer(Methods.GET, target, requestUri),
+ new BasicRequestProducer(Method.GET, target, requestUri),
new AbstractCharResponseConsumer<Void>() {
@Override
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 29f04a6..93bbca7 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
@@ -104,7 +104,7 @@ public class ClientExecuteSOCKS {
if (localAddress != null) {
sock.bind(localAddress);
}
- sock.connect(remoteAddress, connectTimeout != null ? connectTimeout.toMillisIntBound() : 0);
+ sock.connect(remoteAddress, connectTimeout != null ? connectTimeout.toMillisecondsIntBound() : 0);
return sock;
}
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/TestAuthenticationStrategy.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/TestAuthenticationStrategy.java
index e4d612f..8c5c45b 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/TestAuthenticationStrategy.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/TestAuthenticationStrategy.java
@@ -64,18 +64,18 @@ public class TestAuthenticationStrategy {
final HttpClientContext context = HttpClientContext.create();
try {
authStrategy.select(null, Collections.<String, AuthChallenge>emptyMap(), context);
- Assert.fail("IllegalArgumentException expected");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException expected");
+ } catch (final NullPointerException ex) {
}
try {
authStrategy.select(ChallengeType.TARGET, null, context);
- Assert.fail("IllegalArgumentException expected");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException expected");
+ } catch (final NullPointerException ex) {
}
try {
authStrategy.select(ChallengeType.TARGET, Collections.<String, AuthChallenge>emptyMap(), null);
- Assert.fail("IllegalArgumentException expected");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException expected");
+ } catch (final NullPointerException ex) {
}
}
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/TestDefaultConnKeepAliveStrategy.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/TestDefaultConnKeepAliveStrategy.java
index 460b1a3..7f63789 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/TestDefaultConnKeepAliveStrategy.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/TestDefaultConnKeepAliveStrategy.java
@@ -41,7 +41,7 @@ import org.junit.Test;
*/
public class TestDefaultConnKeepAliveStrategy {
- @Test(expected=IllegalArgumentException.class)
+ @Test(expected=NullPointerException.class)
public void testIllegalResponseArg() throws Exception {
final HttpContext context = new BasicHttpContext(null);
final ConnectionKeepAliveStrategy keepAliveStrat = new DefaultConnectionKeepAliveStrategy();
@@ -54,7 +54,7 @@ public class TestDefaultConnKeepAliveStrategy {
final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK);
final ConnectionKeepAliveStrategy keepAliveStrat = new DefaultConnectionKeepAliveStrategy();
final TimeValue d = keepAliveStrat.getKeepAliveDuration(response, context);
- Assert.assertEquals(TimeValue.NEG_ONE_MILLISECONDS, d);
+ Assert.assertEquals(TimeValue.NEG_ONE_MILLISECOND, d);
}
@Test
@@ -64,7 +64,7 @@ public class TestDefaultConnKeepAliveStrategy {
response.addHeader("Keep-Alive", "timeout, max=20");
final ConnectionKeepAliveStrategy keepAliveStrat = new DefaultConnectionKeepAliveStrategy();
final TimeValue d = keepAliveStrat.getKeepAliveDuration(response, context);
- Assert.assertEquals(TimeValue.NEG_ONE_MILLISECONDS, d);
+ Assert.assertEquals(TimeValue.NEG_ONE_MILLISECOND, d);
}
@Test
@@ -74,7 +74,7 @@ public class TestDefaultConnKeepAliveStrategy {
response.addHeader("Keep-Alive", "timeout=whatever, max=20");
final ConnectionKeepAliveStrategy keepAliveStrat = new DefaultConnectionKeepAliveStrategy();
final TimeValue d = keepAliveStrat.getKeepAliveDuration(response, context);
- Assert.assertEquals(TimeValue.NEG_ONE_MILLISECONDS, d);
+ Assert.assertEquals(TimeValue.NEG_ONE_MILLISECOND, d);
}
@Test
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/TestDefaultRedirectStrategy.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/TestDefaultRedirectStrategy.java
index 6ca7e60..06a6a94 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/TestDefaultRedirectStrategy.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/TestDefaultRedirectStrategy.java
@@ -114,13 +114,13 @@ public class TestDefaultRedirectStrategy {
final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_SEE_OTHER, "Redirect");
try {
redirectStrategy.isRedirected(null, response, context);
- Assert.fail("IllegalArgumentException expected");
- } catch (final IllegalArgumentException expected) {
+ Assert.fail("NullPointerException expected");
+ } catch (final NullPointerException expected) {
}
try {
redirectStrategy.isRedirected(httpget, null, context);
- Assert.fail("IllegalArgumentException expected");
- } catch (final IllegalArgumentException expected) {
+ Assert.fail("NullPointerException expected");
+ } catch (final NullPointerException expected) {
}
}
@@ -207,18 +207,18 @@ public class TestDefaultRedirectStrategy {
response.addHeader("Location", "http://localhost/stuff");
try {
redirectStrategy.getLocationURI(null, response, context);
- Assert.fail("IllegalArgumentException expected");
- } catch (final IllegalArgumentException expected) {
+ Assert.fail("NullPointerException expected");
+ } catch (final NullPointerException expected) {
}
try {
redirectStrategy.getLocationURI(httpget, null, context);
- Assert.fail("IllegalArgumentException expected");
- } catch (final IllegalArgumentException expected) {
+ Assert.fail("NullPointerException expected");
+ } catch (final NullPointerException expected) {
}
try {
redirectStrategy.getLocationURI(httpget, response, null);
- Assert.fail("IllegalArgumentException expected");
- } catch (final IllegalArgumentException expected) {
+ Assert.fail("NullPointerException expected");
+ } catch (final NullPointerException expected) {
}
}
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/auth/TestBasicAuthCache.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/auth/TestBasicAuthCache.java
index 6279805..d1ebfe7 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/auth/TestBasicAuthCache.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/auth/TestBasicAuthCache.java
@@ -51,7 +51,7 @@ public class TestBasicAuthCache {
Assert.assertNull(cache.get(new HttpHost("localhost", 80)));
}
- @Test(expected = IllegalArgumentException.class)
+ @Test(expected = NullPointerException.class)
public void testNullKey() throws Exception {
final BasicAuthCache cache = new BasicAuthCache();
final AuthScheme authScheme = new BasicScheme();
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/auth/TestDigestScheme.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/auth/TestDigestScheme.java
index 363f1bc..9fafcc2 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/auth/TestDigestScheme.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/auth/TestDigestScheme.java
@@ -157,18 +157,18 @@ public class TestDigestScheme {
try {
authscheme.isResponseReady(null, credentialsProvider, null);
- Assert.fail("IllegalArgumentException should have been thrown");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException should have been thrown");
+ } catch (final NullPointerException ex) {
}
try {
authscheme.isResponseReady(host, null, null);
- Assert.fail("IllegalArgumentException should have been thrown");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException should have been thrown");
+ } catch (final NullPointerException ex) {
}
try {
authscheme.generateAuthResponse(host, null, null);
- Assert.fail("IllegalArgumentException should have been thrown");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException should have been thrown");
+ } catch (final NullPointerException ex) {
}
}
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/auth/TestRequestAuthCache.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/auth/TestRequestAuthCache.java
index 29dbc37..29b784a 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/auth/TestRequestAuthCache.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/auth/TestRequestAuthCache.java
@@ -71,14 +71,14 @@ public class TestRequestAuthCache {
this.credProvider.setCredentials(this.authscope2, this.creds2);
}
- @Test(expected=IllegalArgumentException.class)
+ @Test(expected=NullPointerException.class)
public void testRequestParameterCheck() throws Exception {
final HttpClientContext context = HttpClientContext.create();
final HttpRequestInterceptor interceptor = new RequestAuthCache();
interceptor.process(null, null, context);
}
- @Test(expected=IllegalArgumentException.class)
+ @Test(expected=NullPointerException.class)
public void testContextParameterCheck() throws Exception {
final HttpRequest request = new BasicHttpRequest("GET", "/");
final HttpRequestInterceptor interceptor = new RequestAuthCache();
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestContentCompressionExec.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestContentCompressionExec.java
index fa2ff2b..ff045da 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestContentCompressionExec.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestContentCompressionExec.java
@@ -39,7 +39,7 @@ import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.http.Methods;
+import org.apache.hc.core5.http.Method;
import org.apache.hc.core5.http.io.entity.StringEntity;
import org.apache.hc.core5.http.message.BasicClassicHttpRequest;
import org.apache.hc.core5.http.message.BasicClassicHttpResponse;
@@ -77,7 +77,7 @@ public class TestContentCompressionExec {
@Test
public void testContentEncodingNoEntity() throws Exception {
- final ClassicHttpRequest request = new BasicClassicHttpRequest(Methods.GET, host, "/");
+ final ClassicHttpRequest request = new BasicClassicHttpRequest(Method.GET, host, "/");
final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
Mockito.when(execChain.proceed(request, scope)).thenReturn(response);
@@ -90,7 +90,7 @@ public class TestContentCompressionExec {
@Test
public void testNoContentEncoding() throws Exception {
- final ClassicHttpRequest request = new BasicClassicHttpRequest(Methods.GET, host, "/");
+ final ClassicHttpRequest request = new BasicClassicHttpRequest(Method.GET, host, "/");
final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
final StringEntity original = new StringEntity("plain stuff");
response.setEntity(original);
@@ -106,7 +106,7 @@ public class TestContentCompressionExec {
@Test
public void testGzipContentEncoding() throws Exception {
- final ClassicHttpRequest request = new BasicClassicHttpRequest(Methods.GET, host, "/");
+ final ClassicHttpRequest request = new BasicClassicHttpRequest(Method.GET, host, "/");
final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
final HttpEntity original = EntityBuilder.create().setText("encoded stuff").setContentEncoding("GZip").build();
response.setEntity(original);
@@ -122,7 +122,7 @@ public class TestContentCompressionExec {
@Test
public void testGzipContentEncodingZeroLength() throws Exception {
- final ClassicHttpRequest request = new BasicClassicHttpRequest(Methods.GET, host, "/");
+ final ClassicHttpRequest request = new BasicClassicHttpRequest(Method.GET, host, "/");
final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
final HttpEntity original = EntityBuilder.create().setText("").setContentEncoding("GZip").build();
response.setEntity(original);
@@ -138,7 +138,7 @@ public class TestContentCompressionExec {
@Test
public void testXGzipContentEncoding() throws Exception {
- final ClassicHttpRequest request = new BasicClassicHttpRequest(Methods.GET, host, "/");
+ final ClassicHttpRequest request = new BasicClassicHttpRequest(Method.GET, host, "/");
final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
final HttpEntity original = EntityBuilder.create().setText("encoded stuff").setContentEncoding("x-gzip").build();
response.setEntity(original);
@@ -154,7 +154,7 @@ public class TestContentCompressionExec {
@Test
public void testDeflateContentEncoding() throws Exception {
- final ClassicHttpRequest request = new BasicClassicHttpRequest(Methods.GET, host, "/");
+ final ClassicHttpRequest request = new BasicClassicHttpRequest(Method.GET, host, "/");
final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
final HttpEntity original = EntityBuilder.create().setText("encoded stuff").setContentEncoding("deFlaTe").build();
response.setEntity(original);
@@ -170,7 +170,7 @@ public class TestContentCompressionExec {
@Test
public void testIdentityContentEncoding() throws Exception {
- final ClassicHttpRequest request = new BasicClassicHttpRequest(Methods.GET, host, "/");
+ final ClassicHttpRequest request = new BasicClassicHttpRequest(Method.GET, host, "/");
final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
final HttpEntity original = EntityBuilder.create().setText("encoded stuff").setContentEncoding("identity").build();
response.setEntity(original);
@@ -186,7 +186,7 @@ public class TestContentCompressionExec {
@Test(expected=HttpException.class)
public void testUnknownContentEncoding() throws Exception {
- final ClassicHttpRequest request = new BasicClassicHttpRequest(Methods.GET, host, "/");
+ final ClassicHttpRequest request = new BasicClassicHttpRequest(Method.GET, host, "/");
final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
final HttpEntity original = EntityBuilder.create().setText("encoded stuff").setContentEncoding("whatever").build();
response.setEntity(original);
@@ -200,7 +200,7 @@ public class TestContentCompressionExec {
@Test
public void testContentEncodingRequestParameter() throws Exception {
- final ClassicHttpRequest request = new BasicClassicHttpRequest(Methods.GET, host, "/");
+ final ClassicHttpRequest request = new BasicClassicHttpRequest(Method.GET, host, "/");
final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
final HttpEntity original = EntityBuilder.create().setText("encoded stuff").setContentEncoding("GZip").build();
response.setEntity(original);
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestBasicClientCookie.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestBasicClientCookie.java
index ed2c1e1..4ad3e9c 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestBasicClientCookie.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestBasicClientCookie.java
@@ -48,8 +48,8 @@ public class TestBasicClientCookie {
Assert.assertEquals("value", cookie.getValue());
try {
new BasicClientCookie(null, null);
- Assert.fail("IllegalArgumentException should have been thrown");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException should have been thrown");
+ } catch (final NullPointerException ex) {
//expected
}
}
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestBasicCookieAttribHandlers.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestBasicCookieAttribHandlers.java
index a362625..b10fbe9 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestBasicCookieAttribHandlers.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestBasicCookieAttribHandlers.java
@@ -193,32 +193,32 @@ public class TestBasicCookieAttribHandlers {
final CookieAttributeHandler h = new BasicDomainHandler();
try {
h.parse(null, null);
- Assert.fail("IllegalArgumentException must have been thrown");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException must have been thrown");
+ } catch (final NullPointerException ex) {
// expected
}
try {
h.validate(null, null);
- Assert.fail("IllegalArgumentException must have been thrown");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException must have been thrown");
+ } catch (final NullPointerException ex) {
// expected
}
try {
h.validate(new BasicClientCookie("name", "value"), null);
- Assert.fail("IllegalArgumentException must have been thrown");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException must have been thrown");
+ } catch (final NullPointerException ex) {
// expected
}
try {
h.match(null, null);
- Assert.fail("IllegalArgumentException must have been thrown");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException must have been thrown");
+ } catch (final NullPointerException ex) {
// expected
}
try {
h.match(new BasicClientCookie("name", "value"), null);
- Assert.fail("IllegalArgumentException must have been thrown");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException must have been thrown");
+ } catch (final NullPointerException ex) {
// expected
}
}
@@ -302,20 +302,20 @@ public class TestBasicCookieAttribHandlers {
final CookieAttributeHandler h = new BasicPathHandler();
try {
h.parse(null, null);
- Assert.fail("IllegalArgumentException must have been thrown");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException must have been thrown");
+ } catch (final NullPointerException ex) {
// expected
}
try {
h.match(null, null);
- Assert.fail("IllegalArgumentException must have been thrown");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException must have been thrown");
+ } catch (final NullPointerException ex) {
// expected
}
try {
h.match(new BasicClientCookie("name", "value"), null);
- Assert.fail("IllegalArgumentException must have been thrown");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException must have been thrown");
+ } catch (final NullPointerException ex) {
// expected
}
}
@@ -351,8 +351,8 @@ public class TestBasicCookieAttribHandlers {
final CookieAttributeHandler h = new BasicMaxAgeHandler();
try {
h.parse(null, null);
- Assert.fail("IllegalArgumentException must have been thrown");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException must have been thrown");
+ } catch (final NullPointerException ex) {
// expected
}
}
@@ -390,20 +390,20 @@ public class TestBasicCookieAttribHandlers {
final CookieAttributeHandler h = new BasicSecureHandler();
try {
h.parse(null, null);
- Assert.fail("IllegalArgumentException must have been thrown");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException must have been thrown");
+ } catch (final NullPointerException ex) {
// expected
}
try {
h.match(null, null);
- Assert.fail("IllegalArgumentException must have been thrown");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException must have been thrown");
+ } catch (final NullPointerException ex) {
// expected
}
try {
h.match(new BasicClientCookie("name", "value"), null);
- Assert.fail("IllegalArgumentException must have been thrown");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException must have been thrown");
+ } catch (final NullPointerException ex) {
// expected
}
}
@@ -445,15 +445,15 @@ public class TestBasicCookieAttribHandlers {
public void testBasicExpiresInvalidInput() throws Exception {
try {
new BasicExpiresHandler(null);
- Assert.fail("IllegalArgumentException must have been thrown");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException must have been thrown");
+ } catch (final NullPointerException ex) {
// expected
}
final CookieAttributeHandler h = new BasicExpiresHandler(new String[] {DateUtils.PATTERN_RFC1123});
try {
h.parse(null, null);
- Assert.fail("IllegalArgumentException must have been thrown");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException must have been thrown");
+ } catch (final NullPointerException ex) {
// expected
}
}
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestLaxCookieAttribHandlers.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestLaxCookieAttribHandlers.java
index 4a1a204..4a9dd27 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestLaxCookieAttribHandlers.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/cookie/TestLaxCookieAttribHandlers.java
@@ -82,8 +82,8 @@ public class TestLaxCookieAttribHandlers {
final CookieAttributeHandler h = new LaxMaxAgeHandler();
try {
h.parse(null, "stuff");
- Assert.fail("IllegalArgumentException must have been thrown");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException must have been thrown");
+ } catch (final NullPointerException ex) {
// expected
}
}
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestBasicHttpClientConnectionManager.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestBasicHttpClientConnectionManager.java
index 3ccc651..1e603e3 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestBasicHttpClientConnectionManager.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestBasicHttpClientConnectionManager.java
@@ -180,7 +180,7 @@ public class TestBasicHttpClientConnectionManager {
Mockito.when(conn.isOpen()).thenReturn(Boolean.TRUE, Boolean.FALSE);
- mgr.release(endpoint1, null, TimeValue.NEG_ONE_MILLISECONDS);
+ mgr.release(endpoint1, null, TimeValue.NEG_ONE_MILLISECOND);
Assert.assertEquals(route1, mgr.getRoute());
Assert.assertEquals(null, mgr.getState());
@@ -227,15 +227,15 @@ public class TestBasicHttpClientConnectionManager {
Mockito.verify(connFactory, Mockito.times(2)).createConnection(Mockito.<Socket>any());
}
- @Test(expected=IllegalArgumentException.class)
+ @Test(expected=NullPointerException.class)
public void testReleaseInvalidArg() throws Exception {
- mgr.release(null, null, TimeValue.NEG_ONE_MILLISECONDS);
+ mgr.release(null, null, TimeValue.NEG_ONE_MILLISECOND);
}
@Test(expected=IllegalStateException.class)
public void testReleaseAnotherConnection() throws Exception {
final ConnectionEndpoint wrongCon = Mockito.mock(ConnectionEndpoint.class);
- mgr.release(wrongCon, null, TimeValue.NEG_ONE_MILLISECONDS);
+ mgr.release(wrongCon, null, TimeValue.NEG_ONE_MILLISECOND);
}
@Test
@@ -253,7 +253,7 @@ public class TestBasicHttpClientConnectionManager {
Mockito.when(conn.isOpen()).thenReturn(Boolean.TRUE);
- mgr.release(endpoint1, null, TimeValue.NEG_ONE_MILLISECONDS);
+ mgr.release(endpoint1, null, TimeValue.NEG_ONE_MILLISECOND);
mgr.close();
@@ -316,7 +316,7 @@ public class TestBasicHttpClientConnectionManager {
Mockito.when(conn.isOpen()).thenReturn(Boolean.TRUE, Boolean.FALSE);
- mgr.release(endpoint1, null, TimeValue.NEG_ONE_MILLISECONDS);
+ mgr.release(endpoint1, null, TimeValue.NEG_ONE_MILLISECOND);
Assert.assertEquals(route, mgr.getRoute());
Assert.assertEquals(null, mgr.getState());
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestPoolingHttpClientConnectionManager.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestPoolingHttpClientConnectionManager.java
index 94f2c87..227fa00 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestPoolingHttpClientConnectionManager.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestPoolingHttpClientConnectionManager.java
@@ -98,7 +98,7 @@ public class TestPoolingHttpClientConnectionManager {
final HttpHost target = new HttpHost("localhost", 80);
final HttpRoute route = new HttpRoute(target);
- final PoolEntry<HttpRoute, ManagedHttpClientConnection> entry = new PoolEntry<>(route, TimeValue.NEG_ONE_MILLISECONDS);
+ final PoolEntry<HttpRoute, ManagedHttpClientConnection> entry = new PoolEntry<>(route, TimeValue.NEG_ONE_MILLISECOND);
entry.assignConnection(conn);
Mockito.when(future.isCancelled()).thenReturn(Boolean.FALSE);
@@ -121,7 +121,7 @@ public class TestPoolingHttpClientConnectionManager {
Assert.assertNotNull(endpoint1);
Assert.assertNotSame(conn, endpoint1);
- mgr.release(endpoint1, null, TimeValue.NEG_ONE_MILLISECONDS);
+ mgr.release(endpoint1, null, TimeValue.NEG_ONE_MILLISECOND);
Mockito.verify(pool).release(entry, true);
}
@@ -131,7 +131,7 @@ public class TestPoolingHttpClientConnectionManager {
final HttpHost target = new HttpHost("localhost", 80);
final HttpRoute route = new HttpRoute(target);
- final PoolEntry<HttpRoute, ManagedHttpClientConnection> entry = new PoolEntry<>(route, TimeValue.NEG_ONE_MILLISECONDS);
+ final PoolEntry<HttpRoute, ManagedHttpClientConnection> entry = new PoolEntry<>(route, TimeValue.NEG_ONE_MILLISECOND);
Mockito.when(future.isCancelled()).thenReturn(Boolean.FALSE);
Mockito.when(socketFactoryRegistry.lookup("http")).thenReturn(plainSocketFactory);
@@ -153,7 +153,7 @@ public class TestPoolingHttpClientConnectionManager {
Assert.assertNotNull(endpoint1);
Assert.assertNotSame(conn, endpoint1);
- mgr.release(endpoint1, null, TimeValue.NEG_ONE_MILLISECONDS);
+ mgr.release(endpoint1, null, TimeValue.NEG_ONE_MILLISECOND);
Mockito.verify(pool).release(entry, false);
}
@@ -163,7 +163,7 @@ public class TestPoolingHttpClientConnectionManager {
final HttpHost target = new HttpHost("localhost", 80);
final HttpRoute route = new HttpRoute(target);
- final PoolEntry<HttpRoute, ManagedHttpClientConnection> entry = new PoolEntry<>(route, TimeValue.NEG_ONE_MILLISECONDS);
+ final PoolEntry<HttpRoute, ManagedHttpClientConnection> entry = new PoolEntry<>(route, TimeValue.NEG_ONE_MILLISECOND);
entry.assignConnection(conn);
Mockito.when(future.isCancelled()).thenReturn(Boolean.TRUE);
@@ -202,7 +202,7 @@ public class TestPoolingHttpClientConnectionManager {
final HttpHost target = new HttpHost("localhost", 80);
final HttpRoute route = new HttpRoute(target);
- final PoolEntry<HttpRoute, ManagedHttpClientConnection> entry = new PoolEntry<>(route, TimeValue.NEG_ONE_MILLISECONDS);
+ final PoolEntry<HttpRoute, ManagedHttpClientConnection> entry = new PoolEntry<>(route, TimeValue.NEG_ONE_MILLISECOND);
entry.assignConnection(conn);
Mockito.when(future.isCancelled()).thenReturn(Boolean.FALSE);
@@ -220,7 +220,7 @@ public class TestPoolingHttpClientConnectionManager {
Assert.assertNotNull(endpoint1);
Assert.assertTrue(endpoint1.isConnected());
- mgr.release(endpoint1, "some state", TimeValue.NEG_ONE_MILLISECONDS);
+ mgr.release(endpoint1, "some state", TimeValue.NEG_ONE_MILLISECOND);
Mockito.verify(pool).release(entry, true);
Assert.assertEquals("some state", entry.getState());
@@ -231,7 +231,7 @@ public class TestPoolingHttpClientConnectionManager {
final HttpHost target = new HttpHost("localhost", 80);
final HttpRoute route = new HttpRoute(target);
- final PoolEntry<HttpRoute, ManagedHttpClientConnection> entry = new PoolEntry<>(route, TimeValue.NEG_ONE_MILLISECONDS);
+ final PoolEntry<HttpRoute, ManagedHttpClientConnection> entry = new PoolEntry<>(route, TimeValue.NEG_ONE_MILLISECOND);
entry.assignConnection(conn);
Mockito.when(future.isCancelled()).thenReturn(Boolean.FALSE);
@@ -249,7 +249,7 @@ public class TestPoolingHttpClientConnectionManager {
Assert.assertNotNull(endpoint1);
Assert.assertFalse(endpoint1.isConnected());
- mgr.release(endpoint1, "some state", TimeValue.NEG_ONE_MILLISECONDS);
+ mgr.release(endpoint1, "some state", TimeValue.NEG_ONE_MILLISECOND);
Mockito.verify(pool).release(entry, false);
Assert.assertEquals(null, entry.getState());
@@ -262,7 +262,7 @@ public class TestPoolingHttpClientConnectionManager {
final InetAddress local = InetAddress.getByAddress(new byte[]{127, 0, 0, 1});
final HttpRoute route = new HttpRoute(target, local, true);
- final PoolEntry<HttpRoute, ManagedHttpClientConnection> entry = new PoolEntry<>(route, TimeValue.NEG_ONE_MILLISECONDS);
+ final PoolEntry<HttpRoute, ManagedHttpClientConnection> entry = new PoolEntry<>(route, TimeValue.NEG_ONE_MILLISECOND);
entry.assignConnection(conn);
Mockito.when(future.isCancelled()).thenReturn(Boolean.FALSE);
@@ -315,7 +315,7 @@ public class TestPoolingHttpClientConnectionManager {
final InetAddress local = InetAddress.getByAddress(new byte[] {127, 0, 0, 1});
final HttpRoute route = new HttpRoute(target, local, proxy, true);
- final PoolEntry<HttpRoute, ManagedHttpClientConnection> entry = new PoolEntry<>(route, TimeValue.NEG_ONE_MILLISECONDS);
+ final PoolEntry<HttpRoute, ManagedHttpClientConnection> entry = new PoolEntry<>(route, TimeValue.NEG_ONE_MILLISECOND);
entry.assignConnection(conn);
Mockito.when(future.isCancelled()).thenReturn(Boolean.FALSE);
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestRouteDirector.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestRouteDirector.java
index 53a7ef9..1630142 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestRouteDirector.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestRouteDirector.java
@@ -81,7 +81,7 @@ public class TestRouteDirector {
}
}
- @Test(expected=IllegalArgumentException.class)
+ @Test(expected=NullPointerException.class)
public void testIllegal() {
final HttpRouteDirector rowdy = new BasicRouteDirector();
final HttpRoute route = new HttpRoute(TARGET1);
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestRouteTracker.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestRouteTracker.java
index 690745e..8b876f6 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestRouteTracker.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestRouteTracker.java
@@ -121,7 +121,7 @@ public class TestRouteTracker {
try {
new RouteTracker(null, LOCAL41);
Assert.fail("null target not detected");
- } catch (final IllegalArgumentException iax) {
+ } catch (final NullPointerException iax) {
// expected
}
}
@@ -191,14 +191,14 @@ public class TestRouteTracker {
try {
rt.connectProxy(null, true);
Assert.fail("missing proxy argument not detected (connect/false)");
- } catch (final IllegalArgumentException iax) {
+ } catch (final NullPointerException iax) {
// expected
}
try {
rt.connectProxy(null, false);
Assert.fail("missing proxy argument not detected (connect/true)");
- } catch (final IllegalArgumentException iax) {
+ } catch (final NullPointerException iax) {
// expected
}
@@ -207,14 +207,14 @@ public class TestRouteTracker {
try {
rt.tunnelProxy(null, false);
Assert.fail("missing proxy argument not detected (tunnel/false)");
- } catch (final IllegalArgumentException iax) {
+ } catch (final NullPointerException iax) {
// expected
}
try {
rt.tunnelProxy(null, true);
Assert.fail("missing proxy argument not detected (tunnel/true)");
- } catch (final IllegalArgumentException iax) {
+ } catch (final NullPointerException iax) {
// expected
}
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestAddCookies.java b/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestAddCookies.java
index 4c50d3f..eb1be95 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestAddCookies.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestAddCookies.java
@@ -84,14 +84,14 @@ public class TestRequestAddCookies {
.build();
}
- @Test(expected=IllegalArgumentException.class)
+ @Test(expected=NullPointerException.class)
public void testRequestParameterCheck() throws Exception {
final HttpClientContext context = HttpClientContext.create();
final HttpRequestInterceptor interceptor = new RequestAddCookies();
interceptor.process(null, null, context);
}
- @Test(expected=IllegalArgumentException.class)
+ @Test(expected=NullPointerException.class)
public void testContextParameterCheck() throws Exception {
final HttpRequest request = new BasicHttpRequest("GET", "/");
final HttpRequestInterceptor interceptor = new RequestAddCookies();
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestClientConnControl.java b/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestClientConnControl.java
index 2c7f5df..40086d9 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestClientConnControl.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestClientConnControl.java
@@ -41,7 +41,7 @@ import org.junit.Test;
public class TestRequestClientConnControl {
- @Test(expected=IllegalArgumentException.class)
+ @Test(expected=NullPointerException.class)
public void testRequestParameterCheck() throws Exception {
final HttpClientContext context = HttpClientContext.create();
final HttpRequestInterceptor interceptor = new RequestClientConnControl();
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestDefaultHeaders.java b/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestDefaultHeaders.java
index 490453b..b34a59f 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestDefaultHeaders.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestDefaultHeaders.java
@@ -41,7 +41,7 @@ import org.junit.Test;
public class TestRequestDefaultHeaders {
- @Test(expected=IllegalArgumentException.class)
+ @Test(expected=NullPointerException.class)
public void testRequestParameterCheck() throws Exception {
final HttpContext context = new BasicHttpContext();
final HttpRequestInterceptor interceptor = new RequestDefaultHeaders();
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestExpectContinue.java b/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestExpectContinue.java
index deac305..500d1ee 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestExpectContinue.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestRequestExpectContinue.java
@@ -111,8 +111,8 @@ public class TestRequestExpectContinue {
final RequestExpectContinue interceptor = new RequestExpectContinue();
try {
interceptor.process(null, null, null);
- Assert.fail("IllegalArgumentException should have been thrown");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException should have been thrown");
+ } catch (final NullPointerException ex) {
// expected
}
}
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestResponseProcessCookies.java b/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestResponseProcessCookies.java
index ed4daa5..b34e3d7 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestResponseProcessCookies.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/protocol/TestResponseProcessCookies.java
@@ -54,14 +54,14 @@ public class TestResponseProcessCookies {
this.cookieStore = new BasicCookieStore();
}
- @Test(expected=IllegalArgumentException.class)
+ @Test(expected=NullPointerException.class)
public void testResponseParameterCheck() throws Exception {
final HttpClientContext context = HttpClientContext.create();
final HttpResponseInterceptor interceptor = new ResponseProcessCookies();
interceptor.process(null, null, context);
}
- @Test(expected=IllegalArgumentException.class)
+ @Test(expected=NullPointerException.class)
public void testContextParameterCheck() throws Exception {
final HttpResponse response = new BasicHttpResponse(200, "OK");
final HttpResponseInterceptor interceptor = new ResponseProcessCookies();
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/routing/TestHttpRoute.java b/httpclient5/src/test/java/org/apache/hc/client5/http/routing/TestHttpRoute.java
index 40893ef..c541124 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/routing/TestHttpRoute.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/routing/TestHttpRoute.java
@@ -239,7 +239,7 @@ public class TestHttpRoute {
new HttpRoute(null, null, chain1, false,
TunnelType.TUNNELLED, LayerType.PLAIN);
Assert.fail("missing target not detected");
- } catch (final IllegalArgumentException iax) {
+ } catch (final NullPointerException iax) {
// expected
}
@@ -532,7 +532,7 @@ public class TestHttpRoute {
try {
new HttpRoute(TARGET1, LOCAL61, null, false);
Assert.fail("missing proxy not detected");
- } catch (final IllegalArgumentException iax) {
+ } catch (final NullPointerException iax) {
// expected
}
}
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/utils/TestDateUtils.java b/httpclient5/src/test/java/org/apache/hc/client5/http/utils/TestDateUtils.java
index 8f1da94..4475fe0 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/utils/TestDateUtils.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/utils/TestDateUtils.java
@@ -80,20 +80,20 @@ public class TestDateUtils {
public void testInvalidInput() throws Exception {
try {
DateUtils.parseDate(null, null, null);
- Assert.fail("IllegalArgumentException should habe been thrown");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException should habe been thrown");
+ } catch (final NullPointerException ex) {
// expected
}
try {
DateUtils.formatDate(null);
- Assert.fail("IllegalArgumentException should habe been thrown");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException should habe been thrown");
+ } catch (final NullPointerException ex) {
// expected
}
try {
DateUtils.formatDate(new Date(), null);
- Assert.fail("IllegalArgumentException should habe been thrown");
- } catch (final IllegalArgumentException ex) {
+ Assert.fail("NullPointerException should habe been thrown");
+ } catch (final NullPointerException ex) {
// expected
}
}
diff --git a/pom.xml b/pom.xml
index cc3e1c0..d116a08 100644
--- a/pom.xml
+++ b/pom.xml
@@ -67,7 +67,7 @@
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
- <httpcore.version>5.0-beta10</httpcore.version>
+ <httpcore.version>5.0-beta11</httpcore.version>
<log4j.version>2.9.1</log4j.version>
<commons-codec.version>1.13</commons-codec.version>
<conscrypt.version>2.2.1</conscrypt.version>