You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by rs...@apache.org on 2019/03/04 19:48:27 UTC

[httpcomponents-client] branch master updated: Upgrade HttpCore to version 5.0-beta7

This is an automated email from the ASF dual-hosted git repository.

rschmitt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git


The following commit(s) were added to refs/heads/master by this push:
     new f8653a0  Upgrade HttpCore to version 5.0-beta7
f8653a0 is described below

commit f8653a011a20f39f6b96aecc744dd4d3fc6c7323
Author: Ryan Schmitt <rs...@apache.org>
AuthorDate: Tue Jan 29 15:09:55 2019 -0800

    Upgrade HttpCore to version 5.0-beta7
---
 .../hc/client5/http/impl/cache/HttpTestUtils.java  |  2 +-
 .../client5/http/impl/cache/TestCachingExec.java   |  2 +-
 .../http/impl/cache/TestCachingExecChain.java      |  2 +-
 .../http/impl/cache/TestProtocolDeviations.java    |  2 +-
 .../http/impl/cache/TestProtocolRequirements.java  | 22 +++++++++++-----------
 .../http/impl/cache/TestRFC5861Compliance.java     |  2 +-
 .../http/fluent/ContentResponseHandler.java        |  3 ++-
 .../org/apache/hc/client5/http/fluent/Request.java |  4 ++--
 .../apache/hc/client5/http/fluent/Response.java    |  4 +---
 .../client5/testing/async/AsyncRandomHandler.java  |  4 ++--
 .../hc/client5/testing/classic/EchoHandler.java    | 10 ++++++----
 .../hc/client5/testing/classic/RandomHandler.java  |  4 +++-
 .../hc/client5/testing/fluent/TestFluent.java      |  3 ++-
 .../testing/sync/TestClientAuthentication.java     |  6 +++---
 .../testing/sync/TestClientRequestExecution.java   |  2 +-
 .../client5/testing/sync/TestContentCodings.java   |  4 ++--
 .../http/classic/methods/RequestBuilder.java       | 20 +++++++++++---------
 .../hc/client5/http/entity/EntityBuilder.java      | 22 +++++++++-------------
 .../impl/async/InternalHttp2AsyncExecRuntime.java  |  3 ++-
 .../client5/http/impl/async/LoggingIOSession.java  | 10 ++++++++--
 .../http/impl/async/MinimalHttp2AsyncClient.java   |  3 ++-
 .../nio/DefaultAsyncClientConnectionOperator.java  |  6 ++++--
 .../nio/DefaultManagedAsyncClientConnection.java   |  6 ++++--
 .../http/ssl/AbstractClientTlsStrategy.java        |  6 ++++--
 .../http/classic/methods/TestRequestBuilder.java   |  7 +++----
 .../http/entity/TestDecompressingEntity.java       |  3 ++-
 .../apache/hc/client5/http/entity/TestDeflate.java |  3 ++-
 .../apache/hc/client5/http/entity/TestGZip.java    |  7 +++----
 .../client5/http/impl/auth/TestDigestScheme.java   |  5 +++--
 .../impl/classic/TestContentCompressionExec.java   | 22 ++++++++--------------
 .../apache/hc/client5/http/utils/TestURIUtils.java |  2 +-
 pom.xml                                            |  2 +-
 32 files changed, 107 insertions(+), 96 deletions(-)

diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/HttpTestUtils.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/HttpTestUtils.java
index 15634ab..550b78a 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/HttpTestUtils.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/HttpTestUtils.java
@@ -234,7 +234,7 @@ public class HttpTestUtils {
      *  @return an {@link HttpEntity}
      */
     public static HttpEntity makeBody(final int nbytes) {
-        return new ByteArrayEntity(getRandomBytes(nbytes));
+        return new ByteArrayEntity(getRandomBytes(nbytes), null);
     }
 
     public static HttpCacheEntry makeCacheEntry(final Date requestDate, final Date responseDate) {
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCachingExec.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCachingExec.java
index 671f1e6..171da3e 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCachingExec.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCachingExec.java
@@ -357,7 +357,7 @@ public class TestCachingExec extends TestCachingExecChain {
                 }
                 return 'y';
             }
-        }, -1));
+        }, -1, null));
 
         final ClassicHttpResponse resp = mockExecChain.proceed(
                 isA(ClassicHttpRequest.class), isA(ExecChain.Scope.class));
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCachingExecChain.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCachingExecChain.java
index bb9c3be..c0dfed8 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCachingExecChain.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCachingExecChain.java
@@ -1219,7 +1219,7 @@ public abstract class TestCachingExecChain {
                 }
                 throw new SocketTimeoutException("Read timed out");
             }
-        }, 128));
+        }, 128, null));
         resp1.setHeader("Date", DateUtils.formatDate(now));
 
         backendExpectsAnyRequestAndReturn(resp1);
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestProtocolDeviations.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestProtocolDeviations.java
index 4da0da1..cd8078d 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestProtocolDeviations.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestProtocolDeviations.java
@@ -146,7 +146,7 @@ public class TestProtocolDeviations {
     private HttpEntity makeBody(final int nbytes) {
         final byte[] bytes = new byte[nbytes];
         new Random().nextBytes(bytes);
-        return new ByteArrayEntity(bytes);
+        return new ByteArrayEntity(bytes, null);
     }
 
     public static HttpRequest eqRequest(final HttpRequest in) {
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestProtocolRequirements.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestProtocolRequirements.java
index 3bd7e54..c1c55a0 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestProtocolRequirements.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestProtocolRequirements.java
@@ -50,8 +50,8 @@ import org.apache.hc.core5.http.HttpHost;
 import org.apache.hc.core5.http.HttpStatus;
 import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.ProtocolVersion;
-import org.apache.hc.core5.http.io.entity.BasicHttpEntity;
 import org.apache.hc.core5.http.io.entity.ByteArrayEntity;
+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;
 import org.apache.hc.core5.http.message.BasicHeader;
@@ -574,7 +574,7 @@ public class TestProtocolRequirements extends AbstractProtocolTest {
         final BasicClassicHttpRequest post = new BasicClassicHttpRequest("POST", "/");
         post.setHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
         post.setHeader("Content-Length", "128");
-        post.setEntity(new BasicHttpEntity());
+        post.setEntity(new StringEntity("whatever"));
 
         final Capture<ClassicHttpRequest> reqCap = EasyMock.newCapture();
 
@@ -613,7 +613,7 @@ public class TestProtocolRequirements extends AbstractProtocolTest {
     public void testRequestsNotExpecting100ContinueBehaviorShouldNotSetExpectContinueHeader() throws Exception {
         final BasicClassicHttpRequest post = new BasicClassicHttpRequest("POST", "/");
         post.setHeader("Content-Length", "128");
-        post.setEntity(new BasicHttpEntity());
+        post.setEntity(new StringEntity("whatever"));
 
         final Capture<ClassicHttpRequest> reqCap = EasyMock.newCapture();
 
@@ -1382,7 +1382,7 @@ public class TestProtocolRequirements extends AbstractProtocolTest {
         for (int i = 0; i < bytes1.length; i++) {
             bytes1[i] = (byte) 1;
         }
-        resp1.setEntity(new ByteArrayEntity(bytes1));
+        resp1.setEntity(new ByteArrayEntity(bytes1, null));
 
         final ClassicHttpRequest req2 = new BasicClassicHttpRequest("GET", "/");
         req2.setHeader("Cache-Control", "no-cache");
@@ -1399,7 +1399,7 @@ public class TestProtocolRequirements extends AbstractProtocolTest {
         for (int i = 0; i < bytes2.length; i++) {
             bytes2[i] = (byte) 2;
         }
-        resp2.setEntity(new ByteArrayEntity(bytes2));
+        resp2.setEntity(new ByteArrayEntity(bytes2, null));
 
         final Date inTwoSeconds = new Date(now.getTime() + 2000L);
         final ClassicHttpRequest req3 = new BasicClassicHttpRequest("GET", "/");
@@ -1411,7 +1411,7 @@ public class TestProtocolRequirements extends AbstractProtocolTest {
         for (int i = 0; i < bytes3.length; i++) {
             bytes3[i] = (byte) 2;
         }
-        resp3.setEntity(new ByteArrayEntity(bytes3));
+        resp3.setEntity(new ByteArrayEntity(bytes3, null));
 
         EasyMock.expect(
                 mockExecChain.proceed(
@@ -1463,7 +1463,7 @@ public class TestProtocolRequirements extends AbstractProtocolTest {
         for (int i = 0; i < bytes1.length; i++) {
             bytes1[i] = (byte) 1;
         }
-        resp1.setEntity(new ByteArrayEntity(bytes1));
+        resp1.setEntity(new ByteArrayEntity(bytes1, null));
 
         final ClassicHttpRequest req2 = new BasicClassicHttpRequest("GET", "/");
         req2.setHeader("Cache-Control", "no-cache");
@@ -1480,7 +1480,7 @@ public class TestProtocolRequirements extends AbstractProtocolTest {
         for (int i = 0; i < bytes2.length; i++) {
             bytes2[i] = (byte) 2;
         }
-        resp2.setEntity(new ByteArrayEntity(bytes2));
+        resp2.setEntity(new ByteArrayEntity(bytes2, null));
 
         final Date inTwoSeconds = new Date(now.getTime() + 2000L);
         final ClassicHttpRequest req3 = new BasicClassicHttpRequest("GET", "/");
@@ -1492,7 +1492,7 @@ public class TestProtocolRequirements extends AbstractProtocolTest {
         for (int i = 0; i < bytes3.length; i++) {
             bytes3[i] = (byte) 2;
         }
-        resp3.setEntity(new ByteArrayEntity(bytes3));
+        resp3.setEntity(new ByteArrayEntity(bytes3, null));
 
         EasyMock.expect(
                 mockExecChain.proceed(
@@ -1550,7 +1550,7 @@ public class TestProtocolRequirements extends AbstractProtocolTest {
             originResponse.setHeader("Cache-Control", "max-age=3600");
             final byte[] bytes = new byte[51];
             new Random().nextBytes(bytes);
-            originResponse.setEntity(new ByteArrayEntity(bytes));
+            originResponse.setEntity(new ByteArrayEntity(bytes, null));
 
             EasyMock.expect(
                     mockExecChain.proceed(
@@ -2529,7 +2529,7 @@ public class TestProtocolRequirements extends AbstractProtocolTest {
         validated.setHeader("Cache-Control", "public");
         validated.setHeader("Last-Modified", DateUtils.formatDate(oneYearAgo));
         validated.setHeader("Content-Length", "128");
-        validated.setEntity(new ByteArrayEntity(bytes));
+        validated.setEntity(new ByteArrayEntity(bytes, null));
 
         final HttpCacheEntry cacheEntry = HttpTestUtils.makeCacheEntry();
 
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestRFC5861Compliance.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestRFC5861Compliance.java
index e466614..c1cd83b 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestRFC5861Compliance.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestRFC5861Compliance.java
@@ -134,7 +134,7 @@ public class TestRFC5861Compliance extends AbstractProtocolTest {
         final byte[] body101 = HttpTestUtils.getRandomBytes(101);
         final ByteArrayInputStream buf = new ByteArrayInputStream(body101);
         final ConsumableInputStream cis = new ConsumableInputStream(buf);
-        final HttpEntity entity = new InputStreamEntity(cis, 101);
+        final HttpEntity entity = new InputStreamEntity(cis, 101, null);
         resp2.setEntity(entity);
 
         backendExpectsAnyRequestAndReturn(resp2);
diff --git a/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/ContentResponseHandler.java b/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/ContentResponseHandler.java
index 55445f6..8663a32 100644
--- a/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/ContentResponseHandler.java
+++ b/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/ContentResponseHandler.java
@@ -29,6 +29,7 @@ package org.apache.hc.client5.http.fluent;
 import java.io.IOException;
 
 import org.apache.hc.client5.http.impl.classic.AbstractHttpClientResponseHandler;
+import org.apache.hc.core5.http.ContentType;
 import org.apache.hc.core5.http.HttpEntity;
 import org.apache.hc.core5.http.io.entity.EntityUtils;
 
@@ -46,7 +47,7 @@ public class ContentResponseHandler extends AbstractHttpClientResponseHandler<Co
     @Override
     public Content handleEntity(final HttpEntity entity) throws IOException {
         return entity != null ?
-                new Content(EntityUtils.toByteArray(entity), EntityUtils.getContentTypeOrDefault(entity)) :
+                new Content(EntityUtils.toByteArray(entity), ContentType.parse(entity.getContentType())) :
                 Content.NO_CONTENT;
     }
 
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 e39c747..2d47327 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
@@ -347,7 +347,7 @@ public class Request {
     }
 
     public Request bodyByteArray(final byte[] b) {
-        return body(new ByteArrayEntity(b));
+        return body(new ByteArrayEntity(b, null));
     }
 
     /**
@@ -358,7 +358,7 @@ public class Request {
     }
 
     public Request bodyByteArray(final byte[] b, final int off, final int len) {
-        return body(new ByteArrayEntity(b, off, len));
+        return body(new ByteArrayEntity(b, off, len, null));
     }
 
     /**
diff --git a/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Response.java b/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Response.java
index ea40c25..72b56b1 100644
--- a/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Response.java
+++ b/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Response.java
@@ -111,9 +111,7 @@ public class Response {
             final HttpEntity entity = this.response.getEntity();
             if (entity != null) {
                 final ByteArrayEntity byteArrayEntity = new ByteArrayEntity(
-                        EntityUtils.toByteArray(entity));
-                final ContentType contentType = EntityUtils.getContentTypeOrDefault(entity);
-                byteArrayEntity.setContentType(contentType.toString());
+                        EntityUtils.toByteArray(entity), ContentType.parse(entity.getContentType()));
                 this.response.setEntity(byteArrayEntity);
             }
             return this.response;
diff --git a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java
index fbbe612..07a5cf5 100644
--- a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java
+++ b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AsyncRandomHandler.java
@@ -164,7 +164,7 @@ public class AsyncRandomHandler implements AsyncServerExchangeHandler {
         private final ByteBuffer buffer;
 
         public RandomBinAsyncEntityProducer(final long len) {
-            super(2048, 512, ContentType.DEFAULT_TEXT);
+            super(512, ContentType.DEFAULT_TEXT);
             length = len;
             remaining = len;
             buffer = ByteBuffer.allocate(1024);
@@ -186,7 +186,7 @@ public class AsyncRandomHandler implements AsyncServerExchangeHandler {
         }
 
         @Override
-        public int available() {
+        public int availableData() {
             return Integer.MAX_VALUE;
         }
 
diff --git a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/classic/EchoHandler.java b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/classic/EchoHandler.java
index be05e26..ead1a30 100644
--- a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/classic/EchoHandler.java
+++ b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/classic/EchoHandler.java
@@ -32,6 +32,7 @@ import java.util.Locale;
 
 import org.apache.hc.core5.http.ClassicHttpRequest;
 import org.apache.hc.core5.http.ClassicHttpResponse;
+import org.apache.hc.core5.http.ContentType;
 import org.apache.hc.core5.http.HttpEntity;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpStatus;
@@ -76,16 +77,17 @@ public class EchoHandler implements HttpRequestHandler {
         // For some reason, just putting the incoming entity into
         // the response will not work. We have to buffer the message.
         final byte[] data;
+        final ContentType contentType;
         if (entity == null) {
             data = new byte [0];
+            contentType = null;
         } else {
             data = EntityUtils.toByteArray(entity);
+            final String contentTypeStr = entity.getContentType();
+            contentType = contentTypeStr == null ? null : ContentType.parse(contentTypeStr);
         }
 
-        final ByteArrayEntity bae = new ByteArrayEntity(data);
-        if (entity != null) {
-            bae.setContentType(entity.getContentType());
-        }
+        final ByteArrayEntity bae = new ByteArrayEntity(data, contentType);
         entity = bae;
 
         response.setCode(HttpStatus.SC_OK);
diff --git a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/classic/RandomHandler.java b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/classic/RandomHandler.java
index e8d944d..8141215 100644
--- a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/classic/RandomHandler.java
+++ b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/classic/RandomHandler.java
@@ -36,6 +36,7 @@ import java.nio.charset.StandardCharsets;
 
 import org.apache.hc.core5.http.ClassicHttpRequest;
 import org.apache.hc.core5.http.ClassicHttpResponse;
+import org.apache.hc.core5.http.ContentType;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpStatus;
 import org.apache.hc.core5.http.MethodNotSupportedException;
@@ -47,7 +48,7 @@ import org.apache.hc.core5.http.protocol.HttpContext;
 /**
  * A handler that generates random data.
  */
-public class RandomHandler implements HttpRequestHandler {
+public class  RandomHandler implements HttpRequestHandler {
 
     /**
      * Handles a request by generating random data.
@@ -127,6 +128,7 @@ public class RandomHandler implements HttpRequestHandler {
          *              0 to maxint
          */
         public RandomEntity(final long len) {
+            super((ContentType) null, null);
             length = len;
         }
 
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/fluent/TestFluent.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/fluent/TestFluent.java
index 412a586..086fdde 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/fluent/TestFluent.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/fluent/TestFluent.java
@@ -75,7 +75,8 @@ public class TestFluent extends LocalServerTestBase {
                 HttpEntity responseEntity = null;
                 final HttpEntity requestEntity = request.getEntity();
                 if (requestEntity != null) {
-                    final ContentType contentType = EntityUtils.getContentTypeOrDefault(requestEntity);
+                    final String contentTypeStr = requestEntity.getContentType();
+                    final ContentType contentType = contentTypeStr == null ? ContentType.DEFAULT_TEXT : ContentType.parse(contentTypeStr);
                     if (ContentType.TEXT_PLAIN.getMimeType().equals(contentType.getMimeType())) {
                         responseEntity = new StringEntity(
                                 EntityUtils.toString(requestEntity), ContentType.TEXT_PLAIN);
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestClientAuthentication.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestClientAuthentication.java
index 0e35298..b18fb4b 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestClientAuthentication.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestClientAuthentication.java
@@ -202,7 +202,7 @@ public class TestClientAuthentication extends LocalServerTestBase {
         httpput.setEntity(new InputStreamEntity(
                 new ByteArrayInputStream(
                         new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 } ),
-                        -1));
+                        -1, null));
         final HttpClientContext context = HttpClientContext.create();
         final TestCredentialsProvider credsProvider = new TestCredentialsProvider(
                 new UsernamePasswordCredentials("test", "test".toCharArray()));
@@ -225,7 +225,7 @@ public class TestClientAuthentication extends LocalServerTestBase {
         httpput.setEntity(new InputStreamEntity(
                 new ByteArrayInputStream(
                         new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 } ),
-                        -1));
+                        -1, null));
 
         final HttpClientContext context = HttpClientContext.create();
         final TestCredentialsProvider credsProvider = new TestCredentialsProvider(
@@ -270,7 +270,7 @@ public class TestClientAuthentication extends LocalServerTestBase {
         final HttpPost httppost = new HttpPost("/");
         httppost.setEntity(new InputStreamEntity(
                 new ByteArrayInputStream(
-                        new byte[] { 0,1,2,3,4,5,6,7,8,9 }), -1));
+                        new byte[] { 0,1,2,3,4,5,6,7,8,9 }), -1, null));
 
         final HttpClientContext context = HttpClientContext.create();
         context.setRequestConfig(RequestConfig.custom()
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestClientRequestExecution.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestClientRequestExecution.java
index a2a4fa8..d56a6be 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestClientRequestExecution.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestClientRequestExecution.java
@@ -189,7 +189,7 @@ public class TestClientRequestExecution extends LocalServerTestBase {
         httppost.setEntity(new InputStreamEntity(
                 new ByteArrayInputStream(
                         new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 } ),
-                        -1));
+                        -1, null));
         this.httpclient.execute(target, httppost, context);
     }
 
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestContentCodings.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestContentCodings.java
index 8b9a490..df37bd9 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestContentCodings.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestContentCodings.java
@@ -313,7 +313,7 @@ public class TestContentCodings extends LocalServerTestBase {
                         final byte[] compressed = new byte[compressedLength];
                         System.arraycopy(output, 0, compressed, 0, compressedLength);
                         response.setEntity(new InputStreamEntity(
-                                new ByteArrayInputStream(compressed), compressedLength));
+                                new ByteArrayInputStream(compressed), compressedLength, null));
                         return;
                     }
                 }
@@ -374,7 +374,7 @@ public class TestContentCodings extends LocalServerTestBase {
 
                         final byte[] arr = bytes.toByteArray();
                         response.setEntity(new InputStreamEntity(new ByteArrayInputStream(arr),
-                                arr.length));
+                                arr.length, null));
 
                         return;
                     }
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/classic/methods/RequestBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/classic/methods/RequestBuilder.java
index 7f79896..4a3572a 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/classic/methods/RequestBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/classic/methods/RequestBuilder.java
@@ -286,18 +286,20 @@ public class RequestBuilder {
         entity = null;
 
         final HttpEntity originalEntity = request.getEntity();
-        final ContentType contentType = EntityUtils.getContentType(originalEntity);
-        if (contentType != null &&
+        if (originalEntity != null) {
+            final ContentType contentType = ContentType.parse(originalEntity.getContentType());
+            if (contentType != null &&
                 contentType.getMimeType().equals(ContentType.APPLICATION_FORM_URLENCODED.getMimeType())) {
-            try {
-                final List<NameValuePair> formParams = EntityUtils.parse(originalEntity);
-                if (!formParams.isEmpty()) {
-                    parameters = formParams;
+                try {
+                    final List<NameValuePair> formParams = EntityUtils.parse(originalEntity);
+                    if (!formParams.isEmpty()) {
+                        parameters = formParams;
+                    }
+                } catch (final IOException ignore) {
                 }
-            } catch (final IOException ignore) {
+            } else {
+                entity = originalEntity;
             }
-        } else {
-            entity = originalEntity;
         }
 
         try {
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/entity/EntityBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/entity/EntityBuilder.java
index 20bf67e..83557b0 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/entity/EntityBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/entity/EntityBuilder.java
@@ -37,7 +37,6 @@ import org.apache.hc.core5.http.ContentType;
 import org.apache.hc.core5.http.HttpEntity;
 import org.apache.hc.core5.http.NameValuePair;
 import org.apache.hc.core5.http.io.entity.AbstractHttpEntity;
-import org.apache.hc.core5.http.io.entity.BasicHttpEntity;
 import org.apache.hc.core5.http.io.entity.ByteArrayEntity;
 import org.apache.hc.core5.http.io.entity.FileEntity;
 import org.apache.hc.core5.http.io.entity.InputStreamEntity;
@@ -311,27 +310,24 @@ public class EntityBuilder {
     public HttpEntity build() {
         final AbstractHttpEntity e;
         if (this.text != null) {
-            e = new StringEntity(this.text, getContentOrDefault(ContentType.DEFAULT_TEXT));
+            e = new StringEntity(this.text, getContentOrDefault(ContentType.DEFAULT_TEXT), this.contentEncoding,
+                this.chunked);
         } else if (this.binary != null) {
-            e = new ByteArrayEntity(this.binary, getContentOrDefault(ContentType.DEFAULT_BINARY));
+            e = new ByteArrayEntity(this.binary, getContentOrDefault(ContentType.DEFAULT_BINARY),
+                this.contentEncoding, this.chunked);
         } else if (this.stream != null) {
-            e = new InputStreamEntity(this.stream, -1, getContentOrDefault(ContentType.DEFAULT_BINARY));
+            e = new InputStreamEntity(this.stream, -1, getContentOrDefault(ContentType.DEFAULT_BINARY),
+                this.contentEncoding);
         } else if (this.parameters != null) {
             e = new UrlEncodedFormEntity(this.parameters,
                     this.contentType != null ? this.contentType.getCharset() : null);
         } else if (this.serializable != null) {
-            e = new SerializableEntity(this.serializable);
-            e.setContentType(ContentType.DEFAULT_BINARY.toString());
+            e = new SerializableEntity(this.serializable, ContentType.DEFAULT_BINARY, this.contentEncoding);
         } else if (this.file != null) {
-            e = new FileEntity(this.file, getContentOrDefault(ContentType.DEFAULT_BINARY));
+            e = new FileEntity(this.file, getContentOrDefault(ContentType.DEFAULT_BINARY), this.contentEncoding);
         } else {
-            e = new BasicHttpEntity();
+            throw new IllegalStateException("No entity set");
         }
-        if (e.getContentType() != null && this.contentType != null) {
-            e.setContentType(this.contentType.toString());
-        }
-        e.setContentEncoding(this.contentEncoding);
-        e.setChunked(this.chunked);
         if (this.gzipCompress) {
             return new GzipCompressingEntity(e);
         }
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttp2AsyncExecRuntime.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttp2AsyncExecRuntime.java
index 311a063..b835d66 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttp2AsyncExecRuntime.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttp2AsyncExecRuntime.java
@@ -170,7 +170,8 @@ class InternalHttp2AsyncExecRuntime implements AsyncExecRuntime {
         final HttpHost target = endpoint.target;
         final RequestConfig requestConfig = context.getRequestConfig();
         final Timeout connectTimeout = requestConfig.getConnectTimeout();
-        return Operations.cancellable(connPool.getSession(target, connectTimeout, new FutureCallback<IOSession>() {
+        return Operations.cancellable(connPool.getSession(target, connectTimeout,
+            new FutureCallback<IOSession>() {
 
             @Override
             public void completed(final IOSession ioSession) {
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 c4f8a64..44a27f0 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
@@ -76,6 +76,11 @@ class LoggingIOSession implements ProtocolIOSession {
     }
 
     @Override
+    public Lock getLock() {
+        return this.session.getLock();
+    }
+
+    @Override
     public Lock lock() {
         return this.session.lock();
     }
@@ -233,8 +238,9 @@ class LoggingIOSession implements ProtocolIOSession {
             final NamedEndpoint endpoint,
             final SSLBufferMode sslBufferMode,
             final SSLSessionInitializer initializer,
-            final SSLSessionVerifier verifier) throws UnsupportedOperationException {
-        session.startTls(sslContext, endpoint, sslBufferMode, initializer, verifier);
+            final SSLSessionVerifier verifier,
+            final Timeout handshakeTimeout) throws UnsupportedOperationException {
+        session.startTls(sslContext, endpoint, sslBufferMode, initializer, verifier, handshakeTimeout);
     }
 
     @Override
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java
index 1f646aa..356355a 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java
@@ -156,7 +156,8 @@ public final class MinimalHttp2AsyncClient extends AbstractMinimalHttpAsyncClien
                     final Timeout connectTimeout = requestConfig.getConnectTimeout();
                     final HttpHost target = new HttpHost(request.getScheme(), request.getAuthority());
 
-                    final Future<IOSession> sessionFuture = connPool.getSession(target, connectTimeout, new FutureCallback<IOSession>() {
+                    final Future<IOSession> sessionFuture = connPool.getSession(target, connectTimeout,
+                        new FutureCallback<IOSession>() {
 
                         @Override
                         public void completed(final IOSession session) {
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/DefaultAsyncClientConnectionOperator.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/DefaultAsyncClientConnectionOperator.java
index 4fb6d6a..1d2a8e9 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/DefaultAsyncClientConnectionOperator.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/DefaultAsyncClientConnectionOperator.java
@@ -95,7 +95,8 @@ final class DefaultAsyncClientConnectionOperator implements AsyncClientConnectio
                                     host,
                                     session.getLocalAddress(),
                                     session.getRemoteAddress(),
-                                    attachment);
+                                    attachment,
+                                    connectTimeout);
                         }
                         future.completed(connection);
                     }
@@ -124,7 +125,8 @@ final class DefaultAsyncClientConnectionOperator implements AsyncClientConnectio
                     host,
                     connection.getLocalAddress(),
                     connection.getRemoteAddress(),
-                    attachment);
+                    attachment,
+                    null);
         }
 
     }
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/DefaultManagedAsyncClientConnection.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/DefaultManagedAsyncClientConnection.java
index 867b5e7..39f3284 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/DefaultManagedAsyncClientConnection.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/DefaultManagedAsyncClientConnection.java
@@ -149,12 +149,14 @@ final class DefaultManagedAsyncClientConnection implements ManagedAsyncClientCon
             final NamedEndpoint endpoint,
             final SSLBufferMode sslBufferMode,
             final SSLSessionInitializer initializer,
-            final SSLSessionVerifier verifier) throws UnsupportedOperationException {
+            final SSLSessionVerifier verifier,
+            final Timeout handshakeTimeout) throws UnsupportedOperationException {
         if (log.isDebugEnabled()) {
             log.debug(getId() + ": start TLS");
         }
         if (ioSession instanceof TransportSecurityLayer) {
-            ((TransportSecurityLayer) ioSession).startTls(sslContext, endpoint, sslBufferMode, initializer, verifier);
+            ((TransportSecurityLayer) ioSession).startTls(sslContext, endpoint, sslBufferMode, initializer, verifier,
+                handshakeTimeout);
         } else {
             throw new UnsupportedOperationException("TLS upgrade not supported");
         }
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 c4cf48b..ed694e8 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
@@ -50,6 +50,7 @@ import org.apache.hc.core5.reactor.ssl.SSLSessionVerifier;
 import org.apache.hc.core5.reactor.ssl.TlsDetails;
 import org.apache.hc.core5.reactor.ssl.TransportSecurityLayer;
 import org.apache.hc.core5.util.Args;
+import org.apache.hc.core5.util.Timeout;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -86,7 +87,8 @@ abstract class AbstractClientTlsStrategy implements TlsStrategy {
             final HttpHost host,
             final SocketAddress localAddress,
             final SocketAddress remoteAddress,
-            final Object attachment) {
+            final Object attachment,
+            final Timeout handshakeTimeout) {
         tlsSession.startTls(sslContext, host, sslBufferManagement, new SSLSessionInitializer() {
 
             @Override
@@ -129,7 +131,7 @@ abstract class AbstractClientTlsStrategy implements TlsStrategy {
                 return createTlsDetails(sslEngine);
             }
 
-        });
+        }, handshakeTimeout);
         return true;
     }
 
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/classic/methods/TestRequestBuilder.java b/httpclient5/src/test/java/org/apache/hc/client5/http/classic/methods/TestRequestBuilder.java
index 69c7112..f121933 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/classic/methods/TestRequestBuilder.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/classic/methods/TestRequestBuilder.java
@@ -41,7 +41,6 @@ import org.apache.hc.core5.http.Header;
 import org.apache.hc.core5.http.HttpEntity;
 import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.NameValuePair;
-import org.apache.hc.core5.http.io.entity.BasicHttpEntity;
 import org.apache.hc.core5.http.io.entity.EntityUtils;
 import org.apache.hc.core5.http.io.entity.StringEntity;
 import org.apache.hc.core5.http.message.BasicHeader;
@@ -69,7 +68,7 @@ public class TestRequestBuilder {
 
     @Test
     public void testBasicWithEntity() throws Exception {
-        final HttpEntity entity = new BasicHttpEntity();
+        final HttpEntity entity = new StringEntity("whatever");
         final ClassicHttpRequest request = RequestBuilder.post().setEntity(entity).build();
         Assert.assertNotNull(request);
         Assert.assertEquals("POST", request.getMethod());
@@ -79,7 +78,7 @@ public class TestRequestBuilder {
 
     @Test
     public void testGetWithEntity() throws Exception {
-        final HttpEntity entity = new BasicHttpEntity();
+        final HttpEntity entity = new StringEntity("whatever");
         final ClassicHttpRequest request = RequestBuilder.get().setEntity(entity).build();
         Assert.assertNotNull(request);
         Assert.assertEquals("GET", request.getMethod());
@@ -156,7 +155,7 @@ public class TestRequestBuilder {
     @Test
     public void testCopyWithQueryParams() throws Exception {
         final HttpGet get = new HttpGet("/stuff?p1=this&p2=that");
-        final RequestBuilder builder = RequestBuilder.copy(get);
+        final RequestBuilder builder = RequestBuilder.copy(get).setEntity(new StringEntity(""));
         final List<NameValuePair> parameters = builder.getParameters();
         Assert.assertNotNull(parameters);
         Assert.assertEquals(0, parameters.size());
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestDecompressingEntity.java b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestDecompressingEntity.java
index e668975..745d518 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestDecompressingEntity.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestDecompressingEntity.java
@@ -36,6 +36,7 @@ import java.util.zip.CRC32;
 import java.util.zip.CheckedInputStream;
 import java.util.zip.Checksum;
 
+import org.apache.hc.core5.http.ContentType;
 import org.apache.hc.core5.http.HttpEntity;
 import org.apache.hc.core5.http.io.entity.EntityUtils;
 import org.apache.hc.core5.http.io.entity.InputStreamEntity;
@@ -63,7 +64,7 @@ public class TestDecompressingEntity {
     public void testStreaming() throws Exception {
         final CRC32 crc32 = new CRC32();
         final ByteArrayInputStream in = new ByteArrayInputStream("1234567890".getBytes(StandardCharsets.US_ASCII));
-        final InputStreamEntity wrapped = new InputStreamEntity(in, -1);
+        final InputStreamEntity wrapped = new InputStreamEntity(in, -1, ContentType.DEFAULT_TEXT);
         final ChecksumEntity entity = new ChecksumEntity(wrapped, crc32);
         Assert.assertTrue(entity.isStreaming());
         final String s = EntityUtils.toString(entity);
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestDeflate.java b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestDeflate.java
index a14110d..bb1c731 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestDeflate.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestDeflate.java
@@ -30,6 +30,7 @@ package org.apache.hc.client5.http.entity;
 import java.nio.charset.StandardCharsets;
 import java.util.zip.Deflater;
 
+import org.apache.hc.core5.http.ContentType;
 import org.apache.hc.core5.http.HttpEntity;
 import org.apache.hc.core5.http.io.entity.ByteArrayEntity;
 import org.apache.hc.core5.http.io.entity.EntityUtils;
@@ -51,7 +52,7 @@ public class TestDeflate {
         compresser.finish();
         final int len = compresser.deflate(compressed);
 
-        final HttpEntity entity = new DeflateDecompressingEntity(new ByteArrayEntity(compressed, 0, len));
+        final HttpEntity entity = new DeflateDecompressingEntity(new ByteArrayEntity(compressed, 0, len, ContentType.APPLICATION_OCTET_STREAM));
         Assert.assertEquals(s, EntityUtils.toString(entity));
     }
 
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestGZip.java b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestGZip.java
index c38fcbd..7dca4c3 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestGZip.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestGZip.java
@@ -49,8 +49,7 @@ public class TestGZip {
     @Test
     public void testBasic() throws Exception {
         final String s = "some kind of text";
-        final StringEntity e = new StringEntity(s, ContentType.TEXT_PLAIN);
-        e.setChunked(false);
+        final StringEntity e = new StringEntity(s, ContentType.TEXT_PLAIN, false);
         final GzipCompressingEntity gzipe = new GzipCompressingEntity(e);
         Assert.assertTrue(gzipe.isChunked());
         Assert.assertEquals(-1, gzipe.getContentLength());
@@ -64,7 +63,7 @@ public class TestGZip {
         final GzipCompressingEntity gzipe = new GzipCompressingEntity(in);
         final ByteArrayOutputStream buf = new ByteArrayOutputStream();
         gzipe.writeTo(buf);
-        final ByteArrayEntity out = new ByteArrayEntity(buf.toByteArray());
+        final ByteArrayEntity out = new ByteArrayEntity(buf.toByteArray(), ContentType.APPLICATION_OCTET_STREAM);
         final GzipDecompressingEntity gunzipe = new GzipDecompressingEntity(out);
         Assert.assertEquals("some kind of text", EntityUtils.toString(gunzipe, StandardCharsets.US_ASCII));
     }
@@ -96,7 +95,7 @@ public class TestGZip {
             bytes[i] = (byte) (data[i] & 0xff);
         }
 
-        try (final GzipDecompressingEntity entity = new GzipDecompressingEntity(new InputStreamEntity(new ByteArrayInputStream(bytes)))) {
+        try (final GzipDecompressingEntity entity = new GzipDecompressingEntity(new InputStreamEntity(new ByteArrayInputStream(bytes), ContentType.APPLICATION_OCTET_STREAM))) {
             Assert.assertEquals("stream-1\nstream-2\n", EntityUtils.toString(entity, StandardCharsets.US_ASCII));
         }
     }
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 e2146cb..e07fe18 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
@@ -46,6 +46,7 @@ import org.apache.hc.client5.http.auth.Credentials;
 import org.apache.hc.client5.http.auth.MalformedChallengeException;
 import org.apache.hc.client5.http.auth.UsernamePasswordCredentials;
 import org.apache.hc.core5.http.ClassicHttpRequest;
+import org.apache.hc.core5.http.ContentType;
 import org.apache.hc.core5.http.HeaderElement;
 import org.apache.hc.core5.http.HttpHost;
 import org.apache.hc.core5.http.HttpRequest;
@@ -641,7 +642,7 @@ public class TestDigestScheme {
     @Test
     public void testDigestAuthenticationQopAuthOrAuthIntNonRepeatableEntity() throws Exception {
         final ClassicHttpRequest request = new BasicClassicHttpRequest("Post", "/");
-        request.setEntity(new InputStreamEntity(new ByteArrayInputStream(new byte[] {'a'}), -1));
+        request.setEntity(new InputStreamEntity(new ByteArrayInputStream(new byte[] {'a'}), -1, ContentType.DEFAULT_TEXT));
         final HttpHost host = new HttpHost("somehost", 80);
         final AuthScope authScope = new AuthScope(host, "realm1", null);
         final BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
@@ -690,7 +691,7 @@ public class TestDigestScheme {
     @Test(expected=AuthenticationException.class)
     public void testDigestAuthenticationQopIntOnlyNonRepeatableEntity() throws Exception {
         final ClassicHttpRequest request = new BasicClassicHttpRequest("Post", "/");
-        request.setEntity(new InputStreamEntity(new ByteArrayInputStream(new byte[] {'a'}), -1));
+        request.setEntity(new InputStreamEntity(new ByteArrayInputStream(new byte[] {'a'}), -1, ContentType.DEFAULT_TEXT));
         final HttpHost host = new HttpHost("somehost", 80);
         final AuthScope authScope = new AuthScope(host, "realm1", null);
         final BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
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 ff96201..ab3294d 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
@@ -32,6 +32,7 @@ import org.apache.hc.client5.http.classic.ExecChain;
 import org.apache.hc.client5.http.classic.ExecRuntime;
 import org.apache.hc.client5.http.config.RequestConfig;
 import org.apache.hc.client5.http.entity.DecompressingEntity;
+import org.apache.hc.client5.http.entity.EntityBuilder;
 import org.apache.hc.client5.http.entity.GzipDecompressingEntity;
 import org.apache.hc.client5.http.protocol.HttpClientContext;
 import org.apache.hc.core5.http.ClassicHttpRequest;
@@ -107,8 +108,7 @@ public class TestContentCompressionExec {
     public void testGzipContentEncoding() throws Exception {
         final ClassicHttpRequest request = new BasicClassicHttpRequest(StandardMethods.GET.name(), host, "/");
         final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
-        final StringEntity original = new StringEntity("encoded stuff");
-        original.setContentEncoding("GZip");
+        final HttpEntity original = EntityBuilder.create().setText("encoded stuff").setContentEncoding("GZip").build();
         response.setEntity(original);
 
         Mockito.when(execChain.proceed(request, scope)).thenReturn(response);
@@ -124,8 +124,7 @@ public class TestContentCompressionExec {
     public void testGzipContentEncodingZeroLength() throws Exception {
         final ClassicHttpRequest request = new BasicClassicHttpRequest(StandardMethods.GET.name(), host, "/");
         final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
-        final StringEntity original = new StringEntity("");
-        original.setContentEncoding("GZip");
+        final HttpEntity original = EntityBuilder.create().setText("").setContentEncoding("GZip").build();
         response.setEntity(original);
 
         Mockito.when(execChain.proceed(request, scope)).thenReturn(response);
@@ -141,8 +140,7 @@ public class TestContentCompressionExec {
     public void testXGzipContentEncoding() throws Exception {
         final ClassicHttpRequest request = new BasicClassicHttpRequest(StandardMethods.GET.name(), host, "/");
         final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
-        final StringEntity original = new StringEntity("encoded stuff");
-        original.setContentEncoding("x-gzip");
+        final HttpEntity original = EntityBuilder.create().setText("encoded stuff").setContentEncoding("x-gzip").build();
         response.setEntity(original);
 
         Mockito.when(execChain.proceed(request, scope)).thenReturn(response);
@@ -158,8 +156,7 @@ public class TestContentCompressionExec {
     public void testDeflateContentEncoding() throws Exception {
         final ClassicHttpRequest request = new BasicClassicHttpRequest(StandardMethods.GET.name(), host, "/");
         final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
-        final StringEntity original = new StringEntity("encoded stuff");
-        original.setContentEncoding("deFlaTe");
+        final HttpEntity original = EntityBuilder.create().setText("encoded stuff").setContentEncoding("deFlaTe").build();
         response.setEntity(original);
 
         Mockito.when(execChain.proceed(request, scope)).thenReturn(response);
@@ -175,8 +172,7 @@ public class TestContentCompressionExec {
     public void testIdentityContentEncoding() throws Exception {
         final ClassicHttpRequest request = new BasicClassicHttpRequest(StandardMethods.GET.name(), host, "/");
         final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
-        final StringEntity original = new StringEntity("encoded stuff");
-        original.setContentEncoding("identity");
+        final HttpEntity original = EntityBuilder.create().setText("encoded stuff").setContentEncoding("identity").build();
         response.setEntity(original);
 
         Mockito.when(execChain.proceed(request, scope)).thenReturn(response);
@@ -192,8 +188,7 @@ public class TestContentCompressionExec {
     public void testUnknownContentEncoding() throws Exception {
         final ClassicHttpRequest request = new BasicClassicHttpRequest(StandardMethods.GET.name(), host, "/");
         final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
-        final StringEntity original = new StringEntity("encoded stuff");
-        original.setContentEncoding("whatever");
+        final HttpEntity original = EntityBuilder.create().setText("encoded stuff").setContentEncoding("whatever").build();
         response.setEntity(original);
 
         impl = new ContentCompressionExec(false);
@@ -207,8 +202,7 @@ public class TestContentCompressionExec {
     public void testContentEncodingRequestParameter() throws Exception {
         final ClassicHttpRequest request = new BasicClassicHttpRequest(StandardMethods.GET.name(), host, "/");
         final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
-        final StringEntity original = new StringEntity("encoded stuff");
-        original.setContentEncoding("GZip");
+        final HttpEntity original = EntityBuilder.create().setText("encoded stuff").setContentEncoding("GZip").build();
         response.setEntity(original);
 
         final RequestConfig config = RequestConfig.custom()
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/utils/TestURIUtils.java b/httpclient5/src/test/java/org/apache/hc/client5/http/utils/TestURIUtils.java
index 3087d47..7b0e08d 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/utils/TestURIUtils.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/utils/TestURIUtils.java
@@ -120,7 +120,7 @@ public class TestURIUtils {
         Assert.assertEquals("http://a/b/c/g", URIUtils.resolve(this.baseURI, "./g").toString());
         Assert.assertEquals("http://a/b/c/g/", URIUtils.resolve(this.baseURI, "g/").toString());
         Assert.assertEquals("http://a/g", URIUtils.resolve(this.baseURI, "/g").toString());
-        Assert.assertEquals("http://g/", URIUtils.resolve(this.baseURI, "//g").toString());
+        Assert.assertEquals("http://g", URIUtils.resolve(this.baseURI, "//g").toString());
         Assert.assertEquals("http://a/b/c/d;p?y", URIUtils.resolve(this.baseURI, "?y").toString());
         Assert.assertEquals("http://a/b/c/d;p?y#f", URIUtils.resolve(this.baseURI, "?y#f")
                 .toString());
diff --git a/pom.xml b/pom.xml
index 82ff76c..3b07910 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-beta6</httpcore.version>
+    <httpcore.version>5.0-beta7</httpcore.version>
     <log4j.version>2.9.1</log4j.version>
     <commons-codec.version>1.12</commons-codec.version>
     <conscrypt.version>1.4.1</conscrypt.version>