You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by gg...@apache.org on 2018/07/30 18:32:26 UTC

[2/2] httpcomponents-core git commit: [HTTPCORE-548] Add missing HttpContext parameter to APIs.

[HTTPCORE-548] Add missing HttpContext parameter to APIs.

Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/5195f956
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/5195f956
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/5195f956

Branch: refs/heads/master
Commit: 5195f956969cde3fccaafac33b542183961e3df0
Parents: 6305f82
Author: Gary Gregory <gg...@apache.org>
Authored: Mon Jul 30 12:32:21 2018 -0600
Committer: Gary Gregory <gg...@apache.org>
Committed: Mon Jul 30 12:32:21 2018 -0600

----------------------------------------------------------------------
 RELEASE_NOTES.txt                               |  3 +++
 .../http/examples/Http2FileServerExample.java   |  6 +++---
 .../examples/Http2FullDuplexClientExample.java  | 11 +++++-----
 .../examples/Http2FullDuplexServerExample.java  |  2 +-
 .../impl/nio/ClientHttp2StreamHandler.java      |  9 ++++----
 .../impl/nio/ServerHttp2StreamHandler.java      |  7 ++++---
 .../impl/nio/ServerPushHttp2StreamHandler.java  |  9 ++++----
 .../bootstrap/Http2MultiplexingRequester.java   | 16 +++++++-------
 .../hc/core5/testing/nio/EchoHandler.java       |  2 +-
 .../core5/testing/nio/Http1IntegrationTest.java | 20 +++++++++---------
 .../core5/testing/nio/Http2IntegrationTest.java | 16 +++++++-------
 .../testing/nio/MultiLineResponseHandler.java   |  2 +-
 .../testing/nio/SingleLineResponseHandler.java  |  2 +-
 .../http/examples/AsyncFileServerExample.java   |  6 +++---
 .../examples/AsyncFullDuplexClientExample.java  | 10 ++++-----
 .../examples/AsyncFullDuplexServerExample.java  |  2 +-
 .../http/examples/AsyncReverseProxyExample.java | 18 ++++++++--------
 .../http/examples/AsyncServerFilterExample.java |  2 +-
 .../http/impl/bootstrap/HttpAsyncRequester.java | 22 ++++++++++----------
 .../http/impl/nio/ClientHttp1StreamHandler.java | 12 +++++------
 .../http/impl/nio/ServerHttp1StreamHandler.java |  7 ++++---
 .../http/nio/AsyncClientExchangeHandler.java    |  7 ++++---
 .../hc/core5/http/nio/AsyncPushProducer.java    |  3 ++-
 .../hc/core5/http/nio/AsyncRequestConsumer.java |  3 ++-
 .../hc/core5/http/nio/AsyncRequestProducer.java |  4 +++-
 .../core5/http/nio/AsyncResponseConsumer.java   |  5 +++--
 .../core5/http/nio/AsyncResponseProducer.java   |  3 ++-
 .../http/nio/AsyncServerRequestHandler.java     |  6 +++---
 .../hc/core5/http/nio/BasicPushProducer.java    |  5 +++--
 .../hc/core5/http/nio/BasicRequestConsumer.java |  3 ++-
 .../hc/core5/http/nio/BasicRequestProducer.java |  5 +++--
 .../core5/http/nio/BasicResponseConsumer.java   |  5 +++--
 .../core5/http/nio/BasicResponseProducer.java   |  5 +++--
 .../hc/core5/http/nio/RequestChannel.java       |  3 ++-
 .../hc/core5/http/nio/ResponseChannel.java      |  7 ++++---
 .../nio/support/AbstractAsyncPushHandler.java   |  6 ++++--
 .../support/AbstractAsyncRequesterConsumer.java |  3 ++-
 .../support/AbstractAsyncResponseConsumer.java  |  3 ++-
 .../AbstractClassicServerExchangeHandler.java   |  2 +-
 .../support/AbstractServerExchangeHandler.java  | 16 +++++++-------
 ...ServerFilterChainExchangeHandlerFactory.java |  6 +++---
 .../BasicAsyncServerExpectationDecorator.java   |  5 ++---
 .../nio/support/BasicClientExchangeHandler.java | 13 ++++++------
 .../ImmediateResponseExchangeHandler.java       |  2 +-
 .../nio/support/TerminalAsyncServerFilter.java  |  6 +++---
 45 files changed, 168 insertions(+), 142 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 965c667..48ffd54 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -45,6 +45,9 @@ adds several incremental improvements.
 
 * HTTPCORE-547: Update org.apache.hc.core5.http.message.HeaderGroup.removeHeaders(String) to return a boolean
   Contributed by Gary Gregory <ggregory at apache.org>
+  
+* HTTPCORE-548: Add missing HttpContext parameter to APIs.
+  Contributed by Gary Gregory <ggregory at apache.org>
 
 Release 5.0-BETA2
 -------------------

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FileServerExample.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FileServerExample.java b/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FileServerExample.java
index 5dc79e0..3811dad 100644
--- a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FileServerExample.java
+++ b/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FileServerExample.java
@@ -149,7 +149,7 @@ public class Http2FileServerExample {
                                     HttpStatus.SC_NOT_FOUND,
                                     "<html><body><h1>File" + file.getPath() +
                                             " not found</h1></body></html>",
-                                    ContentType.TEXT_HTML));
+                                    ContentType.TEXT_HTML), context);
 
                         } else if (!file.canRead() || file.isDirectory()) {
 
@@ -157,7 +157,7 @@ public class Http2FileServerExample {
                             responseTrigger.submitResponse(new BasicResponseProducer(
                                     HttpStatus.SC_FORBIDDEN,
                                     "<html><body><h1>Access denied</h1></body></html>",
-                                    ContentType.TEXT_HTML));
+                                    ContentType.TEXT_HTML), context);
 
                         } else {
 
@@ -177,7 +177,7 @@ public class Http2FileServerExample {
                             EndpointDetails endpoint = coreContext.getEndpointDetails();
                             System.out.println(endpoint + ": serving file " + file.getPath());
                             responseTrigger.submitResponse(new BasicResponseProducer(
-                                    HttpStatus.SC_OK, new FileEntityProducer(file, contentType)));
+                                    HttpStatus.SC_OK, new FileEntityProducer(file, contentType)), context);
                         }
                     }
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FullDuplexClientExample.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FullDuplexClientExample.java b/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FullDuplexClientExample.java
index 446b93a..47674f3 100644
--- a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FullDuplexClientExample.java
+++ b/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FullDuplexClientExample.java
@@ -48,6 +48,7 @@ import org.apache.hc.core5.http.nio.DataStreamChannel;
 import org.apache.hc.core5.http.nio.RequestChannel;
 import org.apache.hc.core5.http.nio.entity.BasicAsyncEntityProducer;
 import org.apache.hc.core5.http.nio.entity.StringAsyncEntityConsumer;
+import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.http.protocol.HttpCoreContext;
 import org.apache.hc.core5.http2.HttpVersionPolicy;
 import org.apache.hc.core5.http2.config.H2Config;
@@ -149,8 +150,8 @@ public class Http2FullDuplexClientExample {
             }
 
             @Override
-            public void produceRequest(final RequestChannel channel) throws HttpException, IOException {
-                requestProducer.sendRequest(channel);
+            public void produceRequest(final RequestChannel channel, HttpContext httpContext) throws HttpException, IOException {
+                requestProducer.sendRequest(channel, httpContext);
             }
 
             @Override
@@ -164,14 +165,14 @@ public class Http2FullDuplexClientExample {
             }
 
             @Override
-            public void consumeInformation(final HttpResponse response) throws HttpException, IOException {
+            public void consumeInformation(final HttpResponse response, HttpContext httpContext) throws HttpException, IOException {
                 System.out.println(requestUri + "->" + response.getCode());
             }
 
             @Override
-            public void consumeResponse(final HttpResponse response, final EntityDetails entityDetails) throws HttpException, IOException {
+            public void consumeResponse(final HttpResponse response, final EntityDetails entityDetails, HttpContext httpContext) throws HttpException, IOException {
                 System.out.println(requestUri + "->" + response.getCode());
-                responseConsumer.consumeResponse(response, entityDetails, null);
+                responseConsumer.consumeResponse(response, entityDetails, httpContext, null);
             }
 
             @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FullDuplexServerExample.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FullDuplexServerExample.java b/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FullDuplexServerExample.java
index 6e25dc5..e8a8aeb 100644
--- a/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FullDuplexServerExample.java
+++ b/httpcore5-h2/src/examples/org/apache/hc/core5/http/examples/Http2FullDuplexServerExample.java
@@ -142,7 +142,7 @@ public class Http2FullDuplexServerExample {
                                     final ResponseChannel responseChannel,
                                     final HttpContext context) throws HttpException, IOException {
                                 final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK);
-                                responseChannel.sendResponse(response, entityDetails);
+                                responseChannel.sendResponse(response, entityDetails, context);
                             }
 
                             @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttp2StreamHandler.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttp2StreamHandler.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttp2StreamHandler.java
index d1b9f65..c442589 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttp2StreamHandler.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttp2StreamHandler.java
@@ -47,6 +47,7 @@ import org.apache.hc.core5.http.message.StatusLine;
 import org.apache.hc.core5.http.nio.AsyncClientExchangeHandler;
 import org.apache.hc.core5.http.nio.DataStreamChannel;
 import org.apache.hc.core5.http.nio.RequestChannel;
+import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.http.protocol.HttpCoreContext;
 import org.apache.hc.core5.http.protocol.HttpProcessor;
 import org.apache.hc.core5.http2.H2ConnectionException;
@@ -160,11 +161,11 @@ class ClientHttp2StreamHandler implements Http2StreamHandler {
 
                     @Override
                     public void sendRequest(
-                            final HttpRequest request, final EntityDetails entityDetails) throws HttpException, IOException {
+                            final HttpRequest request, final EntityDetails entityDetails, final HttpContext httpContext) throws HttpException, IOException {
                         commitRequest(request, entityDetails);
                     }
 
-                });
+                }, context);
                 break;
             case BODY:
                 exchangeHandler.produce(dataChannel);
@@ -190,7 +191,7 @@ class ClientHttp2StreamHandler implements Http2StreamHandler {
                     throw new ProtocolException("Invalid response: " + new StatusLine(response));
                 }
                 if (status > HttpStatus.SC_CONTINUE && status < HttpStatus.SC_SUCCESS) {
-                    exchangeHandler.consumeInformation(response);
+                    exchangeHandler.consumeInformation(response, context);
                 }
                 if (requestState == MessageState.ACK) {
                     if (status == HttpStatus.SC_CONTINUE || status >= HttpStatus.SC_SUCCESS) {
@@ -207,7 +208,7 @@ class ClientHttp2StreamHandler implements Http2StreamHandler {
                 httpProcessor.process(response, entityDetails, context);
                 connMetrics.incrementResponseCount();
 
-                exchangeHandler.consumeResponse(response, entityDetails);
+                exchangeHandler.consumeResponse(response, entityDetails, context);
                 responseState = endStream ? MessageState.COMPLETE : MessageState.BODY;
                 break;
             case BODY:

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttp2StreamHandler.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttp2StreamHandler.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttp2StreamHandler.java
index 38feae6..1a866a7 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttp2StreamHandler.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttp2StreamHandler.java
@@ -50,6 +50,7 @@ import org.apache.hc.core5.http.nio.DataStreamChannel;
 import org.apache.hc.core5.http.nio.HandlerFactory;
 import org.apache.hc.core5.http.nio.ResponseChannel;
 import org.apache.hc.core5.http.nio.support.ImmediateResponseExchangeHandler;
+import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.http.protocol.HttpCoreContext;
 import org.apache.hc.core5.http.protocol.HttpProcessor;
 import org.apache.hc.core5.http2.H2ConnectionException;
@@ -206,20 +207,20 @@ public class ServerHttp2StreamHandler implements Http2StreamHandler {
                 final ResponseChannel responseChannel = new ResponseChannel() {
 
                     @Override
-                    public void sendInformation(final HttpResponse response) throws HttpException, IOException {
+                    public void sendInformation(final HttpResponse response, final HttpContext httpContext) throws HttpException, IOException {
                         commitInformation(response);
                     }
 
                     @Override
                     public void sendResponse(
-                            final HttpResponse response, final EntityDetails responseEntityDetails) throws HttpException, IOException {
+                            final HttpResponse response, final EntityDetails responseEntityDetails, final HttpContext httpContext) throws HttpException, IOException {
                         ServerSupport.validateResponse(response, responseEntityDetails);
                         commitResponse(response, responseEntityDetails);
                     }
 
                     @Override
                     public void pushPromise(
-                            final HttpRequest promise, final AsyncPushProducer pushProducer) throws HttpException, IOException {
+                            final HttpRequest promise, final HttpContext httpContext, final AsyncPushProducer pushProducer) throws HttpException, IOException {
                         commitPromise(promise, pushProducer);
                     }
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerPushHttp2StreamHandler.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerPushHttp2StreamHandler.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerPushHttp2StreamHandler.java
index 1e285d3..af0afe6 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerPushHttp2StreamHandler.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerPushHttp2StreamHandler.java
@@ -44,6 +44,7 @@ import org.apache.hc.core5.http.impl.nio.MessageState;
 import org.apache.hc.core5.http.nio.AsyncPushProducer;
 import org.apache.hc.core5.http.nio.DataStreamChannel;
 import org.apache.hc.core5.http.nio.ResponseChannel;
+import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.http.protocol.HttpCoreContext;
 import org.apache.hc.core5.http.protocol.HttpProcessor;
 import org.apache.hc.core5.http2.H2ConnectionException;
@@ -195,23 +196,23 @@ class ServerPushHttp2StreamHandler implements Http2StreamHandler {
                 pushProducer.produceResponse(new ResponseChannel() {
 
                     @Override
-                    public void sendInformation(final HttpResponse response) throws HttpException, IOException {
+                    public void sendInformation(final HttpResponse response, final HttpContext httpContext) throws HttpException, IOException {
                         commitInformation(response);
                     }
 
                     @Override
                     public void sendResponse(
-                            final HttpResponse response, final EntityDetails entityDetails) throws HttpException, IOException {
+                            final HttpResponse response, final EntityDetails entityDetails, final HttpContext httpContext) throws HttpException, IOException {
                         commitResponse(response, entityDetails);
                     }
 
                     @Override
                     public void pushPromise(
-                            final HttpRequest promise, final AsyncPushProducer pushProducer) throws HttpException, IOException {
+                            final HttpRequest promise, final HttpContext httpContext, final AsyncPushProducer pushProducer) throws HttpException, IOException {
                         commitPromise(promise, pushProducer);
                     }
 
-                });
+                }, context);
                 break;
             case BODY:
                 pushProducer.produce(dataChannel);

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/Http2MultiplexingRequester.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/Http2MultiplexingRequester.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/Http2MultiplexingRequester.java
index b72d59d..23b38b9 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/Http2MultiplexingRequester.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/Http2MultiplexingRequester.java
@@ -141,7 +141,7 @@ public class Http2MultiplexingRequester extends AsyncRequester{
                 @Override
                 public void sendRequest(
                         final HttpRequest request,
-                        final EntityDetails entityDetails) throws HttpException, IOException {
+                        final EntityDetails entityDetails, final HttpContext httpContext) throws HttpException, IOException {
                     final String scheme = request.getScheme();
                     final URIAuthority authority = request.getAuthority();
                     if (authority == null) {
@@ -160,8 +160,8 @@ public class Http2MultiplexingRequester extends AsyncRequester{
                                 }
 
                                 @Override
-                                public void produceRequest(final RequestChannel channel) throws HttpException, IOException {
-                                    channel.sendRequest(request, entityDetails);
+                                public void produceRequest(final RequestChannel channel, final HttpContext httpContext) throws HttpException, IOException {
+                                    channel.sendRequest(request, entityDetails, httpContext);
                                 }
 
                                 @Override
@@ -175,14 +175,14 @@ public class Http2MultiplexingRequester extends AsyncRequester{
                                 }
 
                                 @Override
-                                public void consumeInformation(final HttpResponse response) throws HttpException, IOException {
-                                    exchangeHandler.consumeInformation(response);
+                                public void consumeInformation(final HttpResponse response, final HttpContext httpContext) throws HttpException, IOException {
+                                    exchangeHandler.consumeInformation(response, httpContext);
                                 }
 
                                 @Override
                                 public void consumeResponse(
-                                        final HttpResponse response, final EntityDetails entityDetails) throws HttpException, IOException {
-                                    exchangeHandler.consumeResponse(response, entityDetails);
+                                        final HttpResponse response, final EntityDetails entityDetails, final HttpContext httpContext) throws HttpException, IOException {
+                                    exchangeHandler.consumeResponse(response, entityDetails, httpContext);
                                 }
 
                                 @Override
@@ -227,7 +227,7 @@ public class Http2MultiplexingRequester extends AsyncRequester{
 
                 }
 
-            });
+            }, context);
         } catch (final IOException | HttpException ex) {
             exchangeHandler.failed(ex);
         }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/EchoHandler.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/EchoHandler.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/EchoHandler.java
index 100c982..76df291 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/EchoHandler.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/EchoHandler.java
@@ -70,7 +70,7 @@ public class EchoHandler implements AsyncServerExchangeHandler {
             final ResponseChannel responseChannel,
             final HttpContext context) throws HttpException, IOException {
         final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK);
-        responseChannel.sendResponse(response, entityDetails);
+        responseChannel.sendResponse(response, entityDetails, context);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1IntegrationTest.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1IntegrationTest.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1IntegrationTest.java
index 37e376d..35a7e85 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1IntegrationTest.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1IntegrationTest.java
@@ -701,7 +701,7 @@ public class Http1IntegrationTest extends InternalHttp1ServerTestBase {
                             final Message<HttpRequest, String> request,
                             final AsyncServerRequestHandler.ResponseTrigger responseTrigger,
                             final HttpContext context) throws IOException, HttpException {
-                        responseTrigger.submitResponse(new BasicResponseProducer(HttpStatus.SC_OK, "All is well"));
+                        responseTrigger.submitResponse(new BasicResponseProducer(HttpStatus.SC_OK, "All is well"), context);
 
                     }
                 };
@@ -817,12 +817,13 @@ public class Http1IntegrationTest extends InternalHttp1ServerTestBase {
                                         final Header h = request.getFirstHeader(HttpHeaders.EXPECT);
                                         if (h != null && "100-continue".equalsIgnoreCase(h.getValue())) {
                                             Thread.sleep(random.nextInt(1000));
-                                            responseChannel.sendInformation(new BasicHttpResponse(HttpStatus.SC_CONTINUE));
+                                            responseChannel.sendInformation(new BasicHttpResponse(HttpStatus.SC_CONTINUE), context);
                                         }
                                         final HttpResponse response = new BasicHttpResponse(200);
-                                        responseChannel.sendResponse(response, entityProducer);
+                                        responseChannel.sendResponse(response, entityProducer, context);
                                     }
                                 } catch (final Exception ignore) {
+                                    // ignore
                                 }
                             }
                         });
@@ -918,7 +919,7 @@ public class Http1IntegrationTest extends InternalHttp1ServerTestBase {
                             producer = new BasicResponseProducer(HttpStatus.SC_UNAUTHORIZED, "You shall not pass");
                         }
                         responseProducer.set(producer);
-                        producer.sendResponse(responseChannel);
+                        producer.sendResponse(responseChannel, context);
                     }
 
                     @Override
@@ -1362,7 +1363,7 @@ public class Http1IntegrationTest extends InternalHttp1ServerTestBase {
                                     final AsyncServerRequestHandler.ResponseTrigger responseTrigger,
                                     final HttpContext context) throws IOException, HttpException {
                                 responseTrigger.submitResponse(
-                                        new BasicResponseProducer(new StringAsyncEntityProducer("useful stuff")));
+                                        new BasicResponseProducer(new StringAsyncEntityProducer("useful stuff")), context);
                             }
 
                         };
@@ -1504,7 +1505,7 @@ public class Http1IntegrationTest extends InternalHttp1ServerTestBase {
                             final AsyncServerRequestHandler.ResponseTrigger responseTrigger,
                             final HttpContext context) throws IOException, HttpException {
                         final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_NO_CONTENT);
-                        responseTrigger.submitResponse(new BasicResponseProducer(response));
+                        responseTrigger.submitResponse(new BasicResponseProducer(response), context);
                     }
                 };
             }
@@ -1593,7 +1594,7 @@ public class Http1IntegrationTest extends InternalHttp1ServerTestBase {
                         responseTrigger.submitResponse(new BasicResponseProducer(
                                 HttpStatus.SC_OK,
                                 new DigestingEntityProducer("MD5",
-                                        new StringAsyncEntityProducer("Hello back with some trailers"))));
+                                        new StringAsyncEntityProducer("Hello back with some trailers"))), context);
                     }
                 };
             }
@@ -1655,9 +1656,8 @@ public class Http1IntegrationTest extends InternalHttp1ServerTestBase {
                         final String requestUri = request.getRequestUri();
                         if (requestUri.endsWith("boom")) {
                             throw new ProtocolException("Boom!!!");
-                        } else {
-                            responseChannel.sendResponse(new BasicHttpResponse(200), entityProducer);
                         }
+                        responseChannel.sendResponse(new BasicHttpResponse(200), entityProducer, context);
                     }
 
                     @Override
@@ -1672,7 +1672,7 @@ public class Http1IntegrationTest extends InternalHttp1ServerTestBase {
 
                     @Override
                     public void streamEnd(final List<? extends Header> trailers) throws HttpException, IOException {
-
+                        // empty
                     }
 
                     @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http2IntegrationTest.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http2IntegrationTest.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http2IntegrationTest.java
index 28fdbb6..89662ca 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http2IntegrationTest.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http2IntegrationTest.java
@@ -584,10 +584,10 @@ public class Http2IntegrationTest extends InternalHttp2ServerTestBase {
                             final HttpContext context) throws IOException, HttpException {
                         responseTrigger.pushPromise(
                                 new BasicHttpRequest("GET", createRequestURI(serverEndpoint, "/stuff")),
-                                new BasicPushProducer(new MultiLineEntityProducer("Pushing lots of stuff", 500)));
+                                context, new BasicPushProducer(new MultiLineEntityProducer("Pushing lots of stuff", 500)));
                         responseTrigger.submitResponse(new BasicResponseProducer(
                                 HttpStatus.SC_OK,
-                                new BasicAsyncEntityProducer("Hi there")));
+                                new BasicAsyncEntityProducer("Hi there")), context);
                     }
                 };
             }
@@ -665,7 +665,7 @@ public class Http2IntegrationTest extends InternalHttp2ServerTestBase {
 
                         responseTrigger.pushPromise(
                                 new BasicHttpRequest("GET", createRequestURI(serverEndpoint, "/stuff")),
-                                new BasicPushProducer(new BasicAsyncEntityProducer("Pushing all sorts of stuff")) {
+                                context, new BasicPushProducer(new BasicAsyncEntityProducer("Pushing all sorts of stuff")) {
 
                             @Override
                             public void failed(final Exception cause) {
@@ -676,7 +676,7 @@ public class Http2IntegrationTest extends InternalHttp2ServerTestBase {
                         });
                         responseTrigger.pushPromise(
                                 new BasicHttpRequest("GET", createRequestURI(serverEndpoint, "/more-stuff")),
-                                new BasicPushProducer(new MultiLineEntityProducer("Pushing lots of stuff", 500)) {
+                                context, new BasicPushProducer(new MultiLineEntityProducer("Pushing lots of stuff", 500)) {
 
                             @Override
                             public void failed(final Exception cause) {
@@ -687,7 +687,7 @@ public class Http2IntegrationTest extends InternalHttp2ServerTestBase {
                         });
                         responseTrigger.submitResponse(new BasicResponseProducer(
                                 HttpStatus.SC_OK,
-                                new BasicAsyncEntityProducer("Hi there")));
+                                new BasicAsyncEntityProducer("Hi there")), context);
                     }
                 };
             }
@@ -771,7 +771,7 @@ public class Http2IntegrationTest extends InternalHttp2ServerTestBase {
                             final Message<HttpRequest, String> request,
                             final AsyncServerRequestHandler.ResponseTrigger responseTrigger,
                             final HttpContext context) throws IOException, HttpException {
-                        responseTrigger.submitResponse(new BasicResponseProducer(HttpStatus.SC_OK, "All is well"));
+                        responseTrigger.submitResponse(new BasicResponseProducer(HttpStatus.SC_OK, "All is well"), context);
 
                     }
                 };
@@ -866,7 +866,7 @@ public class Http2IntegrationTest extends InternalHttp2ServerTestBase {
                             producer = new BasicResponseProducer(HttpStatus.SC_UNAUTHORIZED, "You shall not pass");
                         }
                         responseProducer.set(producer);
-                        producer.sendResponse(responseChannel);
+                        producer.sendResponse(responseChannel, context);
                     }
 
                     @Override
@@ -933,7 +933,7 @@ public class Http2IntegrationTest extends InternalHttp2ServerTestBase {
                         responseTrigger.submitResponse(new BasicResponseProducer(
                                 HttpStatus.SC_OK,
                                 new DigestingEntityProducer("MD5",
-                                        new StringAsyncEntityProducer("Hello back with some trailers"))));
+                                        new StringAsyncEntityProducer("Hello back with some trailers"))), context);
                     }
                 };
             }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/MultiLineResponseHandler.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/MultiLineResponseHandler.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/MultiLineResponseHandler.java
index 1bbaaf0..bdfce02 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/MultiLineResponseHandler.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/MultiLineResponseHandler.java
@@ -62,7 +62,7 @@ public class MultiLineResponseHandler extends BasicServerExchangeHandler<Message
                       final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK);
                       responseTrigger.submitResponse(new BasicResponseProducer(
                               response,
-                              new MultiLineEntityProducer(message, count)));
+                              new MultiLineEntityProducer(message, count)), context);
                   }
               }
         );

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/SingleLineResponseHandler.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/SingleLineResponseHandler.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/SingleLineResponseHandler.java
index e0cbe2c..6abebf2 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/SingleLineResponseHandler.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/SingleLineResponseHandler.java
@@ -59,7 +59,7 @@ public class SingleLineResponseHandler extends BasicServerExchangeHandler<Messag
                           final ResponseTrigger responseTrigger,
                           final HttpContext context) throws HttpException, IOException {
                       responseTrigger.submitResponse(new BasicResponseProducer(
-                              HttpStatus.SC_OK, new BasicAsyncEntityProducer(message)));
+                              HttpStatus.SC_OK, new BasicAsyncEntityProducer(message)), context);
                   }
               }
         );

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFileServerExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFileServerExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFileServerExample.java
index 86824f5..0c19747 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFileServerExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFileServerExample.java
@@ -111,7 +111,7 @@ public class AsyncFileServerExample {
                                     HttpStatus.SC_NOT_FOUND,
                                     "<html><body><h1>File " + file.getPath() +
                                             " not found</h1></body></html>",
-                                    ContentType.TEXT_HTML));
+                                    ContentType.TEXT_HTML), context);
 
                         } else if (!file.canRead() || file.isDirectory()) {
 
@@ -119,7 +119,7 @@ public class AsyncFileServerExample {
                             responseTrigger.submitResponse(new BasicResponseProducer(
                                     HttpStatus.SC_FORBIDDEN,
                                     "<html><body><h1>Access denied</h1></body></html>",
-                                    ContentType.TEXT_HTML));
+                                    ContentType.TEXT_HTML), context);
 
                         } else {
 
@@ -139,7 +139,7 @@ public class AsyncFileServerExample {
                             EndpointDetails endpoint = coreContext.getEndpointDetails();
                             System.out.println(endpoint + ": serving file " + file.getPath());
                             responseTrigger.submitResponse(new BasicResponseProducer(
-                                    HttpStatus.SC_OK, new FileEntityProducer(file, contentType)));
+                                    HttpStatus.SC_OK, new FileEntityProducer(file, contentType)), context);
                         }
                     }
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexClientExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexClientExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexClientExample.java
index 1fba0ab..c08fbf6 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexClientExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexClientExample.java
@@ -147,8 +147,8 @@ public class AsyncFullDuplexClientExample {
             }
 
             @Override
-            public void produceRequest(final RequestChannel channel) throws HttpException, IOException {
-                requestProducer.sendRequest(channel);
+            public void produceRequest(final RequestChannel channel, HttpContext httpContext) throws HttpException, IOException {
+                requestProducer.sendRequest(channel, httpContext);
             }
 
             @Override
@@ -162,14 +162,14 @@ public class AsyncFullDuplexClientExample {
             }
 
             @Override
-            public void consumeInformation(final HttpResponse response) throws HttpException, IOException {
+            public void consumeInformation(final HttpResponse response, HttpContext httpContext) throws HttpException, IOException {
                 System.out.println(requestUri + "->" + response.getCode());
             }
 
             @Override
-            public void consumeResponse(final HttpResponse response, final EntityDetails entityDetails) throws HttpException, IOException {
+            public void consumeResponse(final HttpResponse response, final EntityDetails entityDetails, HttpContext httpContext) throws HttpException, IOException {
                 System.out.println(requestUri + "->" + response.getCode());
-                responseConsumer.consumeResponse(response, entityDetails, null);
+                responseConsumer.consumeResponse(response, entityDetails, httpContext, null);
             }
 
             @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexServerExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexServerExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexServerExample.java
index 54c9ca8..e0d72cb 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexServerExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncFullDuplexServerExample.java
@@ -125,7 +125,7 @@ public class AsyncFullDuplexServerExample {
                                     final ResponseChannel responseChannel,
                                     final HttpContext context) throws HttpException, IOException {
                                 final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK);
-                                responseChannel.sendResponse(response, entityDetails);
+                                responseChannel.sendResponse(response, entityDetails, context);
                             }
 
                             @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
index 84953b1..85ce597 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
@@ -283,7 +283,7 @@ public class AsyncReverseProxyExample {
                 if (entityDetails != null) {
                     final Header h = incomingRequest.getFirstHeader(HttpHeaders.EXPECT);
                     if (h != null && "100-continue".equalsIgnoreCase(h.getValue())) {
-                        responseChannel.sendInformation(new BasicHttpResponse(HttpStatus.SC_CONTINUE));
+                        responseChannel.sendInformation(new BasicHttpResponse(HttpStatus.SC_CONTINUE), context);
                     }
                 }
             }
@@ -298,7 +298,7 @@ public class AsyncReverseProxyExample {
                     synchronized (exchangeState) {
                         exchangeState.clientEndpoint = clientEndpoint;
                     }
-                    clientEndpoint.execute(new OutgoingExchangeHandler(targetHost, clientEndpoint, exchangeState), null);
+                    clientEndpoint.execute(new OutgoingExchangeHandler(targetHost, clientEndpoint, exchangeState), context);
                 }
 
                 @Override
@@ -316,7 +316,7 @@ public class AsyncReverseProxyExample {
                     System.out.println("[client<-proxy] " + exchangeState.id + " status " + outgoingResponse.getCode());
 
                     try {
-                        responseChannel.sendResponse(outgoingResponse, exEntityDetails);
+                        responseChannel.sendResponse(outgoingResponse, exEntityDetails, context);
                     } catch (HttpException | IOException ignore) {
                         // ignore
                     }
@@ -476,7 +476,7 @@ public class AsyncReverseProxyExample {
 
         @Override
         public void produceRequest(
-                final RequestChannel channel) throws HttpException, IOException {
+                final RequestChannel channel, HttpContext httpContext) throws HttpException, IOException {
             synchronized (exchangeState) {
                 HttpRequest incomingRequest = exchangeState.request;
                 EntityDetails entityDetails = exchangeState.requestEntityDetails;
@@ -494,7 +494,7 @@ public class AsyncReverseProxyExample {
                 System.out.println("[proxy->origin] " + exchangeState.id + " " +
                         outgoingRequest.getMethod() + " " + outgoingRequest.getRequestUri());
 
-                channel.sendRequest(outgoingRequest, entityDetails);
+                channel.sendRequest(outgoingRequest, entityDetails, httpContext);
             }
         }
 
@@ -536,14 +536,14 @@ public class AsyncReverseProxyExample {
         }
 
         @Override
-        public void consumeInformation(final HttpResponse response) throws HttpException, IOException {
+        public void consumeInformation(final HttpResponse response, HttpContext httpContext) throws HttpException, IOException {
             // ignore
         }
 
         @Override
         public void consumeResponse(
                 final HttpResponse incomingResponse,
-                final EntityDetails entityDetails) throws HttpException, IOException {
+                final EntityDetails entityDetails, HttpContext httpContext) throws HttpException, IOException {
             synchronized (exchangeState) {
                 System.out.println("[proxy<-origin] " + exchangeState.id + " status " + incomingResponse.getCode());
                 if (entityDetails == null) {
@@ -563,7 +563,7 @@ public class AsyncReverseProxyExample {
                 exchangeState.outputEnd = entityDetails == null;
 
                 ResponseChannel responseChannel = exchangeState.responseMessageChannel;
-                responseChannel.sendResponse(outgoingResponse, entityDetails);
+                responseChannel.sendResponse(outgoingResponse, entityDetails, httpContext);
 
                 System.out.println("[client<-proxy] " + exchangeState.id + " status " + outgoingResponse.getCode());
                 if (entityDetails == null) {
@@ -657,7 +657,7 @@ public class AsyncReverseProxyExample {
 
                     try {
                         EntityDetails entityDetails = new BasicEntityDetails(contentLen, ContentType.TEXT_PLAIN);
-                        exchangeState.responseMessageChannel.sendResponse(outgoingResponse, entityDetails);
+                        exchangeState.responseMessageChannel.sendResponse(outgoingResponse, entityDetails, null);
                     } catch (HttpException | IOException ignore) {
                         // ignore
                     }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java
index 2a55087..6168b07 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncServerFilterExample.java
@@ -173,7 +173,7 @@ public class AsyncServerFilterExample {
                         // do something useful
                         responseTrigger.submitResponse(new BasicResponseProducer(
                                 HttpStatus.SC_OK,
-                                new BasicAsyncEntityProducer("Hello", ContentType.TEXT_PLAIN)));
+                                new BasicAsyncEntityProducer("Hello", ContentType.TEXT_PLAIN)), context);
                     }
                 })
                 .create();

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpAsyncRequester.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpAsyncRequester.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpAsyncRequester.java
index 315aae6..84c7e96 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpAsyncRequester.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpAsyncRequester.java
@@ -252,17 +252,17 @@ public class HttpAsyncRequester extends AsyncRequester implements ConnPoolContro
     public void execute(
             final AsyncClientExchangeHandler exchangeHandler,
             final Timeout timeout,
-            final HttpContext context) {
+            final HttpContext executeContext) {
         Args.notNull(exchangeHandler, "Exchange handler");
         Args.notNull(timeout, "Timeout");
-        Args.notNull(context, "Context");
+        Args.notNull(executeContext, "Context");
         try {
             exchangeHandler.produceRequest(new RequestChannel() {
 
                 @Override
                 public void sendRequest(
                         final HttpRequest request,
-                        final EntityDetails entityDetails) throws HttpException, IOException {
+                        final EntityDetails entityDetails, final HttpContext requestContext) throws HttpException, IOException {
                     final String scheme = request.getScheme();
                     final URIAuthority authority = request.getAuthority();
                     if (authority == null) {
@@ -294,8 +294,8 @@ public class HttpAsyncRequester extends AsyncRequester implements ConnPoolContro
                                 }
 
                                 @Override
-                                public void produceRequest(final RequestChannel channel) throws HttpException, IOException {
-                                    channel.sendRequest(request, entityDetails);
+                                public void produceRequest(final RequestChannel channel, final HttpContext httpContext) throws HttpException, IOException {
+                                    channel.sendRequest(request, entityDetails, httpContext);
                                 }
 
                                 @Override
@@ -309,17 +309,17 @@ public class HttpAsyncRequester extends AsyncRequester implements ConnPoolContro
                                 }
 
                                 @Override
-                                public void consumeInformation(final HttpResponse response) throws HttpException, IOException {
-                                    exchangeHandler.consumeInformation(response);
+                                public void consumeInformation(final HttpResponse response, final HttpContext httpContext) throws HttpException, IOException {
+                                    exchangeHandler.consumeInformation(response, httpContext);
                                 }
 
                                 @Override
                                 public void consumeResponse(
-                                        final HttpResponse response, final EntityDetails entityDetails) throws HttpException, IOException {
+                                        final HttpResponse response, final EntityDetails entityDetails, final HttpContext httpContext) throws HttpException, IOException {
                                     if (entityDetails == null) {
                                         endpoint.releaseAndReuse();
                                     }
-                                    exchangeHandler.consumeResponse(response, entityDetails);
+                                    exchangeHandler.consumeResponse(response, entityDetails, httpContext);
                                 }
 
                                 @Override
@@ -338,7 +338,7 @@ public class HttpAsyncRequester extends AsyncRequester implements ConnPoolContro
                                     exchangeHandler.streamEnd(trailers);
                                 }
 
-                            }, context);
+                            }, executeContext);
 
                         }
 
@@ -356,7 +356,7 @@ public class HttpAsyncRequester extends AsyncRequester implements ConnPoolContro
 
                 }
 
-            });
+            }, executeContext);
 
         } catch (final IOException | HttpException ex) {
             exchangeHandler.failed(ex);

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1StreamHandler.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1StreamHandler.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1StreamHandler.java
index a56628c..75cda22 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1StreamHandler.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ClientHttp1StreamHandler.java
@@ -50,6 +50,7 @@ import org.apache.hc.core5.http.nio.CapacityChannel;
 import org.apache.hc.core5.http.nio.DataStreamChannel;
 import org.apache.hc.core5.http.nio.RequestChannel;
 import org.apache.hc.core5.http.nio.ResourceHolder;
+import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.http.protocol.HttpCoreContext;
 import org.apache.hc.core5.http.protocol.HttpProcessor;
 
@@ -181,11 +182,11 @@ class ClientHttp1StreamHandler implements ResourceHolder {
 
                     @Override
                     public void sendRequest(
-                            final HttpRequest request, final EntityDetails entityDetails) throws HttpException, IOException {
+                            final HttpRequest request, final EntityDetails entityDetails, final HttpContext httpContext) throws HttpException, IOException {
                         commitRequest(request, entityDetails);
                     }
 
-                });
+                }, context);
                 break;
             case ACK:
                 outputChannel.suspendOutput();
@@ -210,7 +211,7 @@ class ClientHttp1StreamHandler implements ResourceHolder {
             throw new ProtocolException("Invalid response: " + new StatusLine(response));
         }
         if (status > HttpStatus.SC_CONTINUE && status < HttpStatus.SC_SUCCESS) {
-            exchangeHandler.consumeInformation(response);
+            exchangeHandler.consumeInformation(response, context);
         } else {
             if (!connectionReuseStrategy.keepAlive(committedRequest, response, context)) {
                 keepAlive = false;
@@ -240,7 +241,7 @@ class ClientHttp1StreamHandler implements ResourceHolder {
         context.setAttribute(HttpCoreContext.HTTP_RESPONSE, response);
         httpProcessor.process(response, entityDetails, context);
 
-        exchangeHandler.consumeResponse(response, entityDetails);
+        exchangeHandler.consumeResponse(response, entityDetails, context);
         if (entityDetails == null) {
             if (!keepAlive) {
                 outputChannel.close();
@@ -279,9 +280,8 @@ class ClientHttp1StreamHandler implements ResourceHolder {
             outputChannel.setSocketTimeout(timeout);
             outputChannel.requestOutput();
             return true;
-        } else {
-            return false;
         }
+        return false;
     }
 
     void failed(final Exception cause) {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamHandler.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamHandler.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamHandler.java
index 41ac006..85e8d05 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamHandler.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1StreamHandler.java
@@ -52,6 +52,7 @@ import org.apache.hc.core5.http.nio.HandlerFactory;
 import org.apache.hc.core5.http.nio.ResourceHolder;
 import org.apache.hc.core5.http.nio.ResponseChannel;
 import org.apache.hc.core5.http.nio.support.ImmediateResponseExchangeHandler;
+import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.http.protocol.HttpCoreContext;
 import org.apache.hc.core5.http.protocol.HttpProcessor;
 import org.apache.hc.core5.util.Asserts;
@@ -218,20 +219,20 @@ class ServerHttp1StreamHandler implements ResourceHolder {
         final ResponseChannel responseChannel = new ResponseChannel() {
 
             @Override
-            public void sendInformation(final HttpResponse response) throws HttpException, IOException {
+            public void sendInformation(final HttpResponse response, final HttpContext httpContext) throws HttpException, IOException {
                 commitInformation(response);
             }
 
             @Override
             public void sendResponse(
-                    final HttpResponse response, final EntityDetails responseEntityDetails) throws HttpException, IOException {
+                    final HttpResponse response, final EntityDetails responseEntityDetails, final HttpContext httpContext) throws HttpException, IOException {
                 ServerSupport.validateResponse(response, responseEntityDetails);
                 commitResponse(response, responseEntityDetails);
             }
 
             @Override
             public void pushPromise(
-                    final HttpRequest promise, final AsyncPushProducer pushProducer) throws HttpException, IOException {
+                    final HttpRequest promise, final HttpContext httpContext, final AsyncPushProducer pushProducer) throws HttpException, IOException {
                 commitPromise();
             }
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncClientExchangeHandler.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncClientExchangeHandler.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncClientExchangeHandler.java
index 19f875e..160168d 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncClientExchangeHandler.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncClientExchangeHandler.java
@@ -31,6 +31,7 @@ import java.io.IOException;
 import org.apache.hc.core5.http.EntityDetails;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.protocol.HttpContext;
 
 /**
  * Abstract asynchronous client side message exchange handler that acts as a request producer
@@ -40,11 +41,11 @@ import org.apache.hc.core5.http.HttpResponse;
  */
 public interface AsyncClientExchangeHandler extends AsyncDataExchangeHandler {
 
-    void produceRequest(RequestChannel channel) throws HttpException, IOException;
+    void produceRequest(RequestChannel channel, HttpContext httpContext) throws HttpException, IOException;
 
-    void consumeResponse(HttpResponse response, EntityDetails entityDetails) throws HttpException, IOException;
+    void consumeResponse(HttpResponse response, EntityDetails entityDetails, HttpContext httpContext) throws HttpException, IOException;
 
-    void consumeInformation(HttpResponse response) throws HttpException, IOException;
+    void consumeInformation(HttpResponse response, HttpContext httpContext) throws HttpException, IOException;
 
     void cancel();
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncPushProducer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncPushProducer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncPushProducer.java
index 62f48fe..0aab472 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncPushProducer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncPushProducer.java
@@ -29,6 +29,7 @@ package org.apache.hc.core5.http.nio;
 import java.io.IOException;
 
 import org.apache.hc.core5.http.HttpException;
+import org.apache.hc.core5.http.protocol.HttpContext;
 
 /**
  * Abstract asynchronous push response producer.
@@ -37,7 +38,7 @@ import org.apache.hc.core5.http.HttpException;
  */
 public interface AsyncPushProducer extends AsyncDataProducer {
 
-    void produceResponse(ResponseChannel channel) throws HttpException, IOException;
+    void produceResponse(ResponseChannel channel, HttpContext httpContext) throws HttpException, IOException;
 
     void failed(Exception cause);
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncRequestConsumer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncRequestConsumer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncRequestConsumer.java
index fde2802..f1c8d39 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncRequestConsumer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncRequestConsumer.java
@@ -32,6 +32,7 @@ import org.apache.hc.core5.concurrent.FutureCallback;
 import org.apache.hc.core5.http.EntityDetails;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpRequest;
+import org.apache.hc.core5.http.protocol.HttpContext;
 
 /**
  * Abstract asynchronous request consumer.
@@ -41,7 +42,7 @@ import org.apache.hc.core5.http.HttpRequest;
  */
 public interface AsyncRequestConsumer<T> extends AsyncDataConsumer {
 
-    void consumeRequest(HttpRequest request, EntityDetails entityDetails, FutureCallback<T> resultCallback) throws HttpException, IOException;
+    void consumeRequest(HttpRequest request, EntityDetails entityDetails, HttpContext httpContext, FutureCallback<T> resultCallback) throws HttpException, IOException;
 
     void failed(Exception cause);
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncRequestProducer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncRequestProducer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncRequestProducer.java
index d215b91..29af31f 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncRequestProducer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncRequestProducer.java
@@ -29,6 +29,8 @@ package org.apache.hc.core5.http.nio;
 import java.io.IOException;
 
 import org.apache.hc.core5.http.HttpException;
+import org.apache.hc.core5.http.protocol.HttpContext;
+
 
 /**
  * Abstract asynchronous request producer.
@@ -37,7 +39,7 @@ import org.apache.hc.core5.http.HttpException;
  */
 public interface AsyncRequestProducer extends AsyncDataProducer {
 
-    void sendRequest(RequestChannel requestChannel) throws HttpException, IOException;
+    void sendRequest(RequestChannel requestChannel, HttpContext httpContext) throws HttpException, IOException;
 
     boolean isRepeatable();
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncResponseConsumer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncResponseConsumer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncResponseConsumer.java
index cdd6ce5..7863c12 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncResponseConsumer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncResponseConsumer.java
@@ -32,6 +32,7 @@ import org.apache.hc.core5.concurrent.FutureCallback;
 import org.apache.hc.core5.http.EntityDetails;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.protocol.HttpContext;
 
 /**
  * Abstract asynchronous response consumer.
@@ -41,9 +42,9 @@ import org.apache.hc.core5.http.HttpResponse;
  */
 public interface AsyncResponseConsumer<T> extends AsyncDataConsumer {
 
-    void consumeResponse(HttpResponse response, EntityDetails entityDetails, FutureCallback<T> resultCallback) throws HttpException, IOException;
+    void consumeResponse(HttpResponse response, EntityDetails entityDetails, HttpContext httpContext, FutureCallback<T> resultCallback) throws HttpException, IOException;
 
-    void informationResponse(HttpResponse response) throws HttpException, IOException;
+    void informationResponse(HttpResponse response, HttpContext httpContext) throws HttpException, IOException;
 
     void failed(Exception cause);
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncResponseProducer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncResponseProducer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncResponseProducer.java
index 8796ae1..80dc8f7 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncResponseProducer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncResponseProducer.java
@@ -29,6 +29,7 @@ package org.apache.hc.core5.http.nio;
 import java.io.IOException;
 
 import org.apache.hc.core5.http.HttpException;
+import org.apache.hc.core5.http.protocol.HttpContext;
 
 /**
  * Abstract asynchronous response producer.
@@ -37,7 +38,7 @@ import org.apache.hc.core5.http.HttpException;
  */
 public interface AsyncResponseProducer extends AsyncDataProducer {
 
-    void sendResponse(ResponseChannel channel) throws HttpException, IOException;
+    void sendResponse(ResponseChannel channel, HttpContext httpContext) throws HttpException, IOException;
 
     void failed(Exception cause);
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncServerRequestHandler.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncServerRequestHandler.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncServerRequestHandler.java
index 8ae9e29..1214596 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncServerRequestHandler.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/AsyncServerRequestHandler.java
@@ -43,11 +43,11 @@ public interface AsyncServerRequestHandler<T> {
 
     interface ResponseTrigger {
 
-        void sendInformation(HttpResponse response) throws HttpException, IOException;
+        void sendInformation(HttpResponse response, HttpContext httpContext) throws HttpException, IOException;
 
-        void submitResponse(AsyncResponseProducer responseProducer) throws HttpException, IOException;
+        void submitResponse(AsyncResponseProducer responseProducer, HttpContext httpContext) throws HttpException, IOException;
 
-        void pushPromise(HttpRequest promise, AsyncPushProducer responseProducer) throws HttpException, IOException;
+        void pushPromise(HttpRequest promise, HttpContext httpContext, AsyncPushProducer responseProducer) throws HttpException, IOException;
 
     }
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicPushProducer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicPushProducer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicPushProducer.java
index 09bd73d..df4271c 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicPushProducer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicPushProducer.java
@@ -32,6 +32,7 @@ import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpResponse;
 import org.apache.hc.core5.http.HttpStatus;
 import org.apache.hc.core5.http.message.BasicHttpResponse;
+import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.util.Args;
 
 /**
@@ -56,8 +57,8 @@ public class BasicPushProducer implements AsyncPushProducer {
     }
 
     @Override
-    public void produceResponse(final ResponseChannel channel) throws HttpException, IOException {
-        channel.sendResponse(response, dataProducer);
+    public void produceResponse(final ResponseChannel channel, final HttpContext httpContext) throws HttpException, IOException {
+        channel.sendResponse(response, dataProducer, httpContext);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicRequestConsumer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicRequestConsumer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicRequestConsumer.java
index 5a0853a..9679390 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicRequestConsumer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicRequestConsumer.java
@@ -36,6 +36,7 @@ import org.apache.hc.core5.http.Header;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.Message;
+import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.util.Args;
 
 /**
@@ -55,7 +56,7 @@ public class BasicRequestConsumer<T> implements AsyncRequestConsumer<Message<Htt
     public void consumeRequest(
             final HttpRequest request,
             final EntityDetails entityDetails,
-            final FutureCallback<Message<HttpRequest, T>> resultCallback) throws HttpException, IOException {
+            final HttpContext httpContext, final FutureCallback<Message<HttpRequest, T>> resultCallback) throws HttpException, IOException {
         Args.notNull(request, "Request");
         if (entityDetails != null) {
             dataConsumer.streamStart(entityDetails, new FutureCallback<T>() {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicRequestProducer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicRequestProducer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicRequestProducer.java
index e230a6b..58c00de 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicRequestProducer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicRequestProducer.java
@@ -33,6 +33,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.message.BasicHttpRequest;
+import org.apache.hc.core5.http.protocol.HttpContext;
 
 public class BasicRequestProducer implements AsyncRequestProducer {
 
@@ -61,8 +62,8 @@ public class BasicRequestProducer implements AsyncRequestProducer {
     }
 
     @Override
-    public void sendRequest(final RequestChannel requestChannel) throws HttpException, IOException {
-        requestChannel.sendRequest(request, dataProducer);
+    public void sendRequest(final RequestChannel requestChannel, final HttpContext httpContext) throws HttpException, IOException {
+        requestChannel.sendRequest(request, dataProducer, httpContext);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicResponseConsumer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicResponseConsumer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicResponseConsumer.java
index 30fd3cd..f7c032b 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicResponseConsumer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicResponseConsumer.java
@@ -36,6 +36,7 @@ import org.apache.hc.core5.http.Header;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpResponse;
 import org.apache.hc.core5.http.Message;
+import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.util.Args;
 
 /**
@@ -55,7 +56,7 @@ public class BasicResponseConsumer<T> implements AsyncResponseConsumer<Message<H
     public void consumeResponse(
             final HttpResponse response,
             final EntityDetails entityDetails,
-            final FutureCallback<Message<HttpResponse, T>> resultCallback) throws HttpException, IOException {
+            final HttpContext httpContext, final FutureCallback<Message<HttpResponse, T>> resultCallback) throws HttpException, IOException {
         Args.notNull(response, "Response");
 
         if (entityDetails != null) {
@@ -95,7 +96,7 @@ public class BasicResponseConsumer<T> implements AsyncResponseConsumer<Message<H
     }
 
     @Override
-    public void informationResponse(final HttpResponse response) throws HttpException, IOException {
+    public void informationResponse(final HttpResponse response, final HttpContext httpContext) throws HttpException, IOException {
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicResponseProducer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicResponseProducer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicResponseProducer.java
index a5cd1ab..27cf8e1 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicResponseProducer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/BasicResponseProducer.java
@@ -34,6 +34,7 @@ import org.apache.hc.core5.http.HttpResponse;
 import org.apache.hc.core5.http.HttpStatus;
 import org.apache.hc.core5.http.message.BasicHttpResponse;
 import org.apache.hc.core5.http.nio.entity.BasicAsyncEntityProducer;
+import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.util.Args;
 
 /**
@@ -79,8 +80,8 @@ public class BasicResponseProducer implements AsyncResponseProducer {
     }
 
     @Override
-    public void sendResponse(final ResponseChannel responseChannel) throws HttpException, IOException {
-        responseChannel.sendResponse(response, dataProducer);
+    public void sendResponse(final ResponseChannel responseChannel, final HttpContext httpContext) throws HttpException, IOException {
+        responseChannel.sendResponse(response, dataProducer, httpContext);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/main/java/org/apache/hc/core5/http/nio/RequestChannel.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/RequestChannel.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/RequestChannel.java
index 062de34..3c8285e 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/RequestChannel.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/RequestChannel.java
@@ -34,6 +34,7 @@ import org.apache.hc.core5.annotation.ThreadingBehavior;
 import org.apache.hc.core5.http.EntityDetails;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpRequest;
+import org.apache.hc.core5.http.protocol.HttpContext;
 
 /**
  * Abstract request channel.
@@ -45,6 +46,6 @@ import org.apache.hc.core5.http.HttpRequest;
 @Contract(threading = ThreadingBehavior.SAFE)
 public interface RequestChannel {
 
-    void sendRequest(HttpRequest request, EntityDetails entityDetails) throws HttpException, IOException;
+    void sendRequest(HttpRequest request, EntityDetails entityDetails, HttpContext httpContext) throws HttpException, IOException;
 
 }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/main/java/org/apache/hc/core5/http/nio/ResponseChannel.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/ResponseChannel.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/ResponseChannel.java
index 556ddc8..9eb41ee 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/ResponseChannel.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/ResponseChannel.java
@@ -35,6 +35,7 @@ import org.apache.hc.core5.http.EntityDetails;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.protocol.HttpContext;
 
 /**
  * Abstract response / response promise channel.
@@ -47,10 +48,10 @@ import org.apache.hc.core5.http.HttpResponse;
 @Contract(threading = ThreadingBehavior.SAFE)
 public interface ResponseChannel {
 
-    void sendInformation(HttpResponse response) throws HttpException, IOException;
+    void sendInformation(HttpResponse response, HttpContext httpContext) throws HttpException, IOException;
 
-    void sendResponse(HttpResponse response, EntityDetails entityDetails) throws HttpException, IOException;
+    void sendResponse(HttpResponse response, EntityDetails entityDetails, HttpContext httpContext) throws HttpException, IOException;
 
-    void pushPromise(HttpRequest promise, AsyncPushProducer pushProducer) throws HttpException, IOException;
+    void pushPromise(HttpRequest promise, HttpContext httpContext, AsyncPushProducer pushProducer) throws HttpException, IOException;
 
 }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractAsyncPushHandler.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractAsyncPushHandler.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractAsyncPushHandler.java
index 51084c3..8f02837 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractAsyncPushHandler.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractAsyncPushHandler.java
@@ -43,6 +43,7 @@ import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.util.Args;
 
 /**
+ * @param <T> the future result type returned by a callback.
  * @since 5.0
  */
 public abstract class AbstractAsyncPushHandler<T> implements AsyncPushConsumer {
@@ -57,6 +58,7 @@ public abstract class AbstractAsyncPushHandler<T> implements AsyncPushConsumer {
             final HttpRequest promise, final T responseMessage) throws IOException, HttpException;
 
     protected void handleError(final HttpRequest promise, final Exception cause) {
+        // empty
     }
 
     @Override
@@ -64,8 +66,8 @@ public abstract class AbstractAsyncPushHandler<T> implements AsyncPushConsumer {
             final HttpRequest promise,
             final HttpResponse response,
             final EntityDetails entityDetails,
-            final HttpContext context) throws HttpException, IOException {
-        responseConsumer.consumeResponse(response, entityDetails, new FutureCallback<T>() {
+            final HttpContext httpContext) throws HttpException, IOException {
+        responseConsumer.consumeResponse(response, entityDetails, httpContext, new FutureCallback<T>() {
 
             @Override
             public void completed(final T result) {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractAsyncRequesterConsumer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractAsyncRequesterConsumer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractAsyncRequesterConsumer.java
index b164e6b..52056c4 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractAsyncRequesterConsumer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractAsyncRequesterConsumer.java
@@ -40,6 +40,7 @@ import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.nio.AsyncEntityConsumer;
 import org.apache.hc.core5.http.nio.AsyncRequestConsumer;
 import org.apache.hc.core5.http.nio.CapacityChannel;
+import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.util.Args;
 
 public abstract class AbstractAsyncRequesterConsumer<T, E> implements AsyncRequestConsumer<T> {
@@ -59,7 +60,7 @@ public abstract class AbstractAsyncRequesterConsumer<T, E> implements AsyncReque
     public final void consumeRequest(
             final HttpRequest request,
             final EntityDetails entityDetails,
-            final FutureCallback<T> resultCallback) throws HttpException, IOException {
+            final HttpContext httpContext, final FutureCallback<T> resultCallback) throws HttpException, IOException {
         if (entityDetails != null) {
             entityConsumer.streamStart(entityDetails, new FutureCallback<E>() {
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractAsyncResponseConsumer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractAsyncResponseConsumer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractAsyncResponseConsumer.java
index 9752c73..96dfcbb 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractAsyncResponseConsumer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractAsyncResponseConsumer.java
@@ -41,6 +41,7 @@ import org.apache.hc.core5.http.HttpResponse;
 import org.apache.hc.core5.http.nio.AsyncEntityConsumer;
 import org.apache.hc.core5.http.nio.AsyncResponseConsumer;
 import org.apache.hc.core5.http.nio.CapacityChannel;
+import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.util.Args;
 
 public abstract class AbstractAsyncResponseConsumer<T, E> implements AsyncResponseConsumer<T> {
@@ -62,7 +63,7 @@ public abstract class AbstractAsyncResponseConsumer<T, E> implements AsyncRespon
     public final void consumeResponse(
             final HttpResponse response,
             final EntityDetails entityDetails,
-            final FutureCallback<T> resultCallback) throws HttpException, IOException {
+            final HttpContext httpContext, final FutureCallback<T> resultCallback) throws HttpException, IOException {
         if (entityDetails != null) {
             entityConsumer.streamStart(entityDetails, new FutureCallback<E>() {
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractClassicServerExchangeHandler.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractClassicServerExchangeHandler.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractClassicServerExchangeHandler.java
index 233a9e6..bd94886 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractClassicServerExchangeHandler.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractClassicServerExchangeHandler.java
@@ -186,7 +186,7 @@ public abstract class AbstractClassicServerExchangeHandler implements AsyncServe
                                 return null;
                             }
 
-                        });
+                        }, context);
                     }
                 } catch (final HttpException ex) {
                     throw new IOException(ex.getMessage(), ex);

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/5195f956/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractServerExchangeHandler.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractServerExchangeHandler.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractServerExchangeHandler.java
index 0a69337..613d248 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractServerExchangeHandler.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/AbstractServerExchangeHandler.java
@@ -87,22 +87,22 @@ public abstract class AbstractServerExchangeHandler<T> implements AsyncServerExc
         final AsyncServerRequestHandler.ResponseTrigger responseTrigger = new AsyncServerRequestHandler.ResponseTrigger() {
 
             @Override
-            public void sendInformation(final HttpResponse response) throws HttpException, IOException {
-                responseChannel.sendInformation(response);
+            public void sendInformation(final HttpResponse response, final HttpContext httpContext) throws HttpException, IOException {
+                responseChannel.sendInformation(response, httpContext);
             }
 
             @Override
             public void submitResponse(
-                    final AsyncResponseProducer producer) throws HttpException, IOException {
+                    final AsyncResponseProducer producer, final HttpContext httpContext) throws HttpException, IOException {
                 if (responseProducerRef.compareAndSet(null, producer)) {
-                    producer.sendResponse(responseChannel);
+                    producer.sendResponse(responseChannel, httpContext);
                 }
             }
 
             @Override
             public void pushPromise(
-                    final HttpRequest promise, final AsyncPushProducer pushProducer) throws HttpException, IOException {
-                responseChannel.pushPromise(promise, pushProducer);
+                    final HttpRequest promise, final HttpContext httpContext, final AsyncPushProducer pushProducer) throws HttpException, IOException {
+                responseChannel.pushPromise(promise, httpContext, pushProducer);
             }
 
             @Override
@@ -111,7 +111,7 @@ public abstract class AbstractServerExchangeHandler<T> implements AsyncServerExc
             }
 
         };
-        requestConsumer.consumeRequest(request, entityDetails, new FutureCallback<T>() {
+        requestConsumer.consumeRequest(request, entityDetails, context, new FutureCallback<T>() {
 
             @Override
             public void completed(final T result) {
@@ -120,7 +120,7 @@ public abstract class AbstractServerExchangeHandler<T> implements AsyncServerExc
                 } catch (final HttpException ex) {
                     try {
                         responseTrigger.submitResponse(
-                                new BasicResponseProducer(HttpStatus.SC_INTERNAL_SERVER_ERROR, ex.getMessage()));
+                                new BasicResponseProducer(HttpStatus.SC_INTERNAL_SERVER_ERROR, ex.getMessage()), context);
                     } catch (final HttpException | IOException ex2) {
                         failed(ex2);
                     }