hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject [3/5] httpcomponents-core git commit: Improved logging in integration test classes
Date Sun, 18 Jun 2017 19:17:26 GMT
Improved logging in integration test classes


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

Branch: refs/heads/master
Commit: 41b47a5e840865fd440722fa15ba676cc62c9b2b
Parents: 2912b5a
Author: Oleg Kalnichevski <olegk@apache.org>
Authored: Sat Jun 17 11:04:50 2017 +0200
Committer: Oleg Kalnichevski <olegk@apache.org>
Committed: Sun Jun 18 18:30:48 2017 +0200

----------------------------------------------------------------------
 .../nio/AbstractHttp2StreamMultiplexer.java     |  20 +--
 .../impl/nio/ClientHttp2StreamMultiplexer.java  |  10 ++
 .../impl/nio/ServerHttp2StreamMultiplexer.java  |  10 ++
 .../nio/bootstrap/H2RequesterBootstrap.java     |  14 +-
 .../impl/nio/bootstrap/H2ServerBootstrap.java   |  13 +-
 .../impl/nio/bootstrap/Http2AsyncRequester.java |   4 +-
 .../hc/core5/testing/nio/AsyncRequester.java    |   4 +-
 .../hc/core5/testing/nio/AsyncServer.java       |   3 +-
 .../hc/core5/testing/nio/IOReactorExecutor.java |   3 +-
 .../InternalClientHttp1EventHandlerFactory.java |  13 +-
 .../InternalClientHttp2EventHandlerFactory.java |  21 +--
 .../testing/nio/InternalConnectionListener.java |  67 ---------
 .../nio/InternalHttp1StreamListener.java        |  96 -------------
 .../nio/InternalHttp2StreamListener.java        | 137 -------------------
 .../InternalServerHttp1EventHandlerFactory.java |  14 +-
 .../InternalServerHttp2EventHandlerFactory.java |  21 +--
 .../testing/nio/LoggingConnPoolListener.java    |  72 ++++++++++
 .../testing/nio/LoggingConnectionListener.java  |  67 +++++++++
 .../testing/nio/LoggingHttp1StreamListener.java |  96 +++++++++++++
 .../testing/nio/LoggingHttp2StreamListener.java | 137 +++++++++++++++++++
 .../testing/nio/LoggingIOEventHandler.java      |  16 +--
 .../hc/core5/testing/nio/LoggingIOSession.java  |  45 +++---
 .../testing/nio/LoggingIOSessionDecorator.java  |  49 +++++++
 .../hc/core5/testing/nio/LoggingSupport.java    |  44 ++++++
 .../core5/testing/nio/Http1IntegrationTest.java |   5 +-
 .../nio/Http1ServerAndRequesterTest.java        |  15 +-
 .../core5/testing/nio/Http2IntegrationTest.java |   5 +-
 .../nio/Http2ProtocolNegotiationTest.java       |  18 ++-
 .../nio/Http2ServerAndRequesterTest.java        |  15 +-
 .../nio/InternalHttp1ServerTestBase.java        |   2 +
 .../nio/InternalHttp2ServerTestBase.java        |   2 +
 .../nio/TestDefaultListeningIOReactor.java      |   2 +-
 .../org/apache/hc/core5/function/Decorator.java |  39 ++++++
 .../http/impl/bootstrap/AsyncRequester.java     |   3 +
 .../impl/bootstrap/AsyncRequesterBootstrap.java |  14 +-
 .../core5/http/impl/bootstrap/AsyncServer.java  |   3 +
 .../impl/bootstrap/AsyncServerBootstrap.java    |  15 +-
 .../http/impl/bootstrap/HttpAsyncRequester.java |   4 +-
 .../http/impl/bootstrap/HttpAsyncServer.java    |   4 +-
 .../impl/nio/AbstractHttp1StreamDuplexer.java   |  20 +--
 .../impl/nio/ClientHttp1StreamDuplexer.java     |  10 ++
 .../impl/nio/ServerHttp1StreamDuplexer.java     |  10 ++
 .../reactor/DefaultConnectingIOReactor.java     |   7 +-
 .../reactor/DefaultListeningIOReactor.java      |   9 +-
 .../apache/hc/core5/reactor/IOSessionImpl.java  |   2 +-
 .../hc/core5/reactor/InternalDataChannel.java   |   6 +-
 .../hc/core5/reactor/SingleCoreIOReactor.java   |  18 ++-
 47 files changed, 747 insertions(+), 457 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java
index ed5a537..7fdd81f 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java
@@ -81,14 +81,14 @@ import org.apache.hc.core5.http2.impl.BasicH2TransportMetrics;
 import org.apache.hc.core5.http2.nio.AsyncPingHandler;
 import org.apache.hc.core5.http2.nio.command.PingCommand;
 import org.apache.hc.core5.io.ShutdownType;
-import org.apache.hc.core5.net.InetAddressUtils;
 import org.apache.hc.core5.reactor.Command;
 import org.apache.hc.core5.reactor.TlsCapableIOSession;
 import org.apache.hc.core5.reactor.ssl.TlsDetails;
 import org.apache.hc.core5.util.Args;
 import org.apache.hc.core5.util.ByteArrayBuffer;
+import org.apache.hc.core5.util.Identifiable;
 
-abstract class AbstractHttp2StreamMultiplexer implements HttpConnection {
+abstract class AbstractHttp2StreamMultiplexer implements Identifiable, HttpConnection {
 
     private static final long LINGER_TIME = 1000; // 1 second
 
@@ -172,6 +172,11 @@ abstract class AbstractHttp2StreamMultiplexer implements HttpConnection {
         this.streamListener = streamListener;
     }
 
+    @Override
+    public String getId() {
+        return ioSession.getId();
+    }
+
     abstract Http2StreamHandler createRemotelyInitiatedStream(
             Http2StreamChannel channel, HttpProcessor httpProcessor, BasicHttpConnectionMetrics connMetrics) throws IOException;
 
@@ -1227,17 +1232,6 @@ abstract class AbstractHttp2StreamMultiplexer implements HttpConnection {
         return ioSession.getLocalAddress();
     }
 
-    @Override
-    public String toString() {
-        final SocketAddress remoteAddress = ioSession.getRemoteAddress();
-        final SocketAddress localAddress = ioSession.getLocalAddress();
-        final StringBuilder buffer = new StringBuilder();
-        InetAddressUtils.formatAddress(buffer, localAddress);
-        buffer.append("->");
-        InetAddressUtils.formatAddress(buffer, remoteAddress);
-        return buffer.toString();
-    }
-
     private static class Continuation {
 
         final int streamId;

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttp2StreamMultiplexer.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttp2StreamMultiplexer.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttp2StreamMultiplexer.java
index 985fed7..85f0680 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttp2StreamMultiplexer.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttp2StreamMultiplexer.java
@@ -39,6 +39,7 @@ import org.apache.hc.core5.http2.config.H2Config;
 import org.apache.hc.core5.http2.frame.DefaultFrameFactory;
 import org.apache.hc.core5.http2.frame.FrameFactory;
 import org.apache.hc.core5.http2.frame.StreamIdGenerator;
+import org.apache.hc.core5.net.InetAddressUtils;
 import org.apache.hc.core5.reactor.TlsCapableIOSession;
 
 /**
@@ -93,5 +94,14 @@ public class ClientHttp2StreamMultiplexer extends AbstractHttp2StreamMultiplexer
         return new ClientPushHttp2StreamHandler(channel, httpProcessor, connMetrics, pushHandlerFactory, context);
     }
 
+    @Override
+    public String toString() {
+        final StringBuilder buffer = new StringBuilder();
+        InetAddressUtils.formatAddress(buffer, getLocalAddress());
+        buffer.append("->");
+        InetAddressUtils.formatAddress(buffer, getRemoteAddress());
+        return buffer.toString();
+    }
+
 }
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttp2StreamMultiplexer.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttp2StreamMultiplexer.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttp2StreamMultiplexer.java
index d8a2c68..bb2a9d2 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttp2StreamMultiplexer.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttp2StreamMultiplexer.java
@@ -39,6 +39,7 @@ import org.apache.hc.core5.http2.config.H2Config;
 import org.apache.hc.core5.http2.frame.DefaultFrameFactory;
 import org.apache.hc.core5.http2.frame.FrameFactory;
 import org.apache.hc.core5.http2.frame.StreamIdGenerator;
+import org.apache.hc.core5.net.InetAddressUtils;
 import org.apache.hc.core5.reactor.TlsCapableIOSession;
 import org.apache.hc.core5.util.Args;
 
@@ -86,4 +87,13 @@ public class ServerHttp2StreamMultiplexer extends AbstractHttp2StreamMultiplexer
         return new ServerHttp2StreamHandler(channel, httpProcessor, connMetrics, exchangeHandlerFactory, context);
     }
 
+    @Override
+    public String toString() {
+        final StringBuilder buffer = new StringBuilder();
+        InetAddressUtils.formatAddress(buffer, getRemoteAddress());
+        buffer.append("->");
+        InetAddressUtils.formatAddress(buffer, getLocalAddress());
+        return buffer.toString();
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2RequesterBootstrap.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2RequesterBootstrap.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2RequesterBootstrap.java
index 61e86a8..6d839da 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2RequesterBootstrap.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2RequesterBootstrap.java
@@ -29,8 +29,8 @@ package org.apache.hc.core5.http2.impl.nio.bootstrap;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.hc.core5.function.Decorator;
 import org.apache.hc.core5.function.Supplier;
-import org.apache.hc.core5.http.ExceptionListener;
 import org.apache.hc.core5.http.HttpHost;
 import org.apache.hc.core5.http.config.CharCodingConfig;
 import org.apache.hc.core5.http.config.H1Config;
@@ -51,6 +51,7 @@ import org.apache.hc.core5.http2.ssl.H2ClientTlsStrategy;
 import org.apache.hc.core5.pool.ConnPoolListener;
 import org.apache.hc.core5.pool.ConnPoolPolicy;
 import org.apache.hc.core5.pool.StrictConnPool;
+import org.apache.hc.core5.reactor.IOEventHandlerFactory;
 import org.apache.hc.core5.reactor.IOReactorConfig;
 import org.apache.hc.core5.reactor.IOSession;
 import org.apache.hc.core5.util.Args;
@@ -74,7 +75,7 @@ public class H2RequesterBootstrap {
     private TimeValue timeToLive;
     private ConnPoolPolicy connPoolPolicy;
     private TlsStrategy tlsStrategy;
-    private ExceptionListener exceptionListener;
+    private Decorator<IOSession> ioSessionDecorator;
     private ConnectionListener connectionListener;
     private Http2StreamListener streamListener;
     private Http1StreamListener http1StreamListener;
@@ -168,10 +169,10 @@ public class H2RequesterBootstrap {
     }
 
     /**
-     * Assigns {@link ExceptionListener} instance.
+     * Assigns {@link IOSession} {@link Decorator} instance.
      */
-    public final H2RequesterBootstrap setExceptionListener(final ExceptionListener exceptionListener) {
-        this.exceptionListener = exceptionListener;
+    public final H2RequesterBootstrap setIOSessionDecorator(final Decorator<IOSession> ioSessionDecorator) {
+        this.ioSessionDecorator = ioSessionDecorator;
         return this;
     }
 
@@ -246,7 +247,7 @@ public class H2RequesterBootstrap {
                 charCodingConfig != null ? charCodingConfig : CharCodingConfig.DEFAULT,
                 connectionListener,
                 streamListener);
-        final ClientHttpProtocolNegotiatorFactory ioEventHandlerFactory = new ClientHttpProtocolNegotiatorFactory(
+        final IOEventHandlerFactory ioEventHandlerFactory = new ClientHttpProtocolNegotiatorFactory(
                 http1StreamHandlerFactory,
                 http2StreamHandlerFactory,
                 versionPolicy != null ? versionPolicy : HttpVersionPolicy.NEGOTIATE,
@@ -255,6 +256,7 @@ public class H2RequesterBootstrap {
                 versionPolicy != null ? versionPolicy : HttpVersionPolicy.NEGOTIATE,
                 ioReactorConfig,
                 ioEventHandlerFactory,
+                ioSessionDecorator,
                 connPool,
                 tlsStrategy != null ? tlsStrategy : new H2ClientTlsStrategy());
     }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2ServerBootstrap.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2ServerBootstrap.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2ServerBootstrap.java
index 8842d7b..a5b36b7 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2ServerBootstrap.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/H2ServerBootstrap.java
@@ -29,6 +29,7 @@ package org.apache.hc.core5.http2.impl.nio.bootstrap;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.hc.core5.function.Decorator;
 import org.apache.hc.core5.function.Supplier;
 import org.apache.hc.core5.http.config.CharCodingConfig;
 import org.apache.hc.core5.http.config.H1Config;
@@ -58,6 +59,7 @@ import org.apache.hc.core5.http2.ssl.H2ServerTlsStrategy;
 import org.apache.hc.core5.net.InetAddressUtils;
 import org.apache.hc.core5.reactor.IOEventHandlerFactory;
 import org.apache.hc.core5.reactor.IOReactorConfig;
+import org.apache.hc.core5.reactor.IOSession;
 import org.apache.hc.core5.util.Args;
 
 /**
@@ -74,6 +76,7 @@ public class H2ServerBootstrap {
     private H2Config h2Config;
     private H1Config h1Config;
     private TlsStrategy tlsStrategy;
+    private Decorator<IOSession> ioSessionDecorator;
     private ConnectionListener connectionListener;
     private Http2StreamListener http2StreamListener;
     private Http1StreamListener http1StreamListener;
@@ -153,6 +156,14 @@ public class H2ServerBootstrap {
     }
 
     /**
+     * Assigns {@link IOSession} {@link Decorator} instance.
+     */
+    public final H2ServerBootstrap setIOSessionDecorator(final Decorator<IOSession> ioSessionDecorator) {
+        this.ioSessionDecorator = ioSessionDecorator;
+        return this;
+    }
+
+    /**
      * Assigns {@link ConnectionListener} instance.
      */
     public final H2ServerBootstrap setConnectionListener(final ConnectionListener connectionListener) {
@@ -253,7 +264,7 @@ public class H2ServerBootstrap {
                 versionPolicy != null ? versionPolicy : HttpVersionPolicy.NEGOTIATE,
                 tlsStrategy != null ? tlsStrategy : new H2ServerTlsStrategy(new int[] {443, 8443}),
                 connectionListener);
-        return new HttpAsyncServer(ioEventHandlerFactory, ioReactorConfig);
+        return new HttpAsyncServer(ioEventHandlerFactory, ioSessionDecorator, ioReactorConfig);
     }
 
     private static class HandlerEntry {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/Http2AsyncRequester.java
----------------------------------------------------------------------
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/Http2AsyncRequester.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/Http2AsyncRequester.java
index ef24e38..1161946 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/Http2AsyncRequester.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap/Http2AsyncRequester.java
@@ -30,6 +30,7 @@ package org.apache.hc.core5.http2.impl.nio.bootstrap;
 import java.util.concurrent.Future;
 
 import org.apache.hc.core5.concurrent.FutureCallback;
+import org.apache.hc.core5.function.Decorator;
 import org.apache.hc.core5.http.HttpHost;
 import org.apache.hc.core5.http.impl.bootstrap.HttpAsyncRequester;
 import org.apache.hc.core5.http.nio.AsyncClientEndpoint;
@@ -52,9 +53,10 @@ public class Http2AsyncRequester extends HttpAsyncRequester {
             final HttpVersionPolicy versionPolicy,
             final IOReactorConfig ioReactorConfig,
             final IOEventHandlerFactory eventHandlerFactory,
+            final Decorator<IOSession> ioSessionDecorator,
             final ControlledConnPool<HttpHost, IOSession> connPool,
             final TlsStrategy tlsStrategy) {
-        super(ioReactorConfig, eventHandlerFactory, connPool, tlsStrategy);
+        super(ioReactorConfig, eventHandlerFactory, ioSessionDecorator, connPool, tlsStrategy);
         this.versionPolicy = versionPolicy != null ? versionPolicy : HttpVersionPolicy.NEGOTIATE;
     }
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/AsyncRequester.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/AsyncRequester.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/AsyncRequester.java
index b9ed48e..6445255 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/AsyncRequester.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/AsyncRequester.java
@@ -58,8 +58,8 @@ public class AsyncRequester extends IOReactorExecutor<DefaultConnectingIOReactor
             final IOReactorConfig ioReactorConfig,
             final ThreadFactory threadFactory,
             final Callback<IOSession> sessionShutdownCallback) throws IOException {
-        return new DefaultConnectingIOReactor(
-                ioEventHandlerFactory, ioReactorConfig, threadFactory, sessionShutdownCallback);
+        return new DefaultConnectingIOReactor(ioEventHandlerFactory, ioReactorConfig, threadFactory,
+                LoggingIOSessionDecorator.INSTANCE, sessionShutdownCallback);
     }
 
     private InetSocketAddress toSocketAddress(final HttpHost host) {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/AsyncServer.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/AsyncServer.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/AsyncServer.java
index 56426bd..031ddd2 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/AsyncServer.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/AsyncServer.java
@@ -52,7 +52,8 @@ public class AsyncServer extends IOReactorExecutor<DefaultListeningIOReactor> {
             final IOReactorConfig ioReactorConfig,
             final ThreadFactory threadFactory,
             final Callback<IOSession> sessionShutdownCallback) throws IOException {
-        return new DefaultListeningIOReactor(ioEventHandlerFactory, ioReactorConfig, threadFactory, threadFactory, sessionShutdownCallback);
+        return new DefaultListeningIOReactor(ioEventHandlerFactory, ioReactorConfig, threadFactory, threadFactory,
+                LoggingIOSessionDecorator.INSTANCE, sessionShutdownCallback);
     }
 
     public Future<ListenerEndpoint> listen(final InetSocketAddress address) {

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/IOReactorExecutor.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/IOReactorExecutor.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/IOReactorExecutor.java
index 9a7270d..3b7236d 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/IOReactorExecutor.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/IOReactorExecutor.java
@@ -33,7 +33,6 @@ import java.util.List;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.atomic.AtomicReference;
 
-import org.apache.hc.core5.concurrent.DefaultThreadFactory;
 import org.apache.hc.core5.function.Callback;
 import org.apache.hc.core5.http.nio.command.ShutdownCommand;
 import org.apache.hc.core5.io.ShutdownType;
@@ -75,7 +74,7 @@ abstract class IOReactorExecutor<T extends IOReactorService> implements AutoClos
         if (ioReactorRef.compareAndSet(null, createIOReactor(
                 ioEventHandlerFactory,
                 ioReactorConfig,
-                workerThreadFactory != null ? workerThreadFactory : new DefaultThreadFactory("i/o dispatch"),
+                workerThreadFactory,
                 new Callback<IOSession>() {
 
                     @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalClientHttp1EventHandlerFactory.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalClientHttp1EventHandlerFactory.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalClientHttp1EventHandlerFactory.java
index e32cee7..2168deb 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalClientHttp1EventHandlerFactory.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalClientHttp1EventHandlerFactory.java
@@ -54,8 +54,6 @@ import org.apache.hc.core5.reactor.IOEventHandler;
 import org.apache.hc.core5.reactor.IOEventHandlerFactory;
 import org.apache.hc.core5.reactor.TlsCapableIOSession;
 import org.apache.hc.core5.util.Args;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 
 /**
  * @since 5.0
@@ -107,14 +105,11 @@ class InternalClientHttp1EventHandlerFactory implements IOEventHandlerFactory {
 
     @Override
     public IOEventHandler createHandler(final TlsCapableIOSession ioSession, final Object attachment) {
-        final String id = ioSession.getId();
         if (sslContext != null) {
             ioSession.startTls(sslContext, null ,null, null);
         }
-        final Logger sessionLog = LogManager.getLogger(ioSession.getClass());
-        final Logger wireLog = LogManager.getLogger("org.apache.hc.core5.http.wire");
         final ClientHttp1StreamDuplexer streamDuplexer = createClientHttp1StreamDuplexer(
-                new LoggingIOSession(ioSession, sessionLog, wireLog),
+                ioSession,
                 httpProcessor,
                 h1Config,
                 charCodingConfig,
@@ -123,9 +118,9 @@ class InternalClientHttp1EventHandlerFactory implements IOEventHandlerFactory {
                 requestWriterFactory.create(),
                 DefaultContentLengthStrategy.INSTANCE,
                 DefaultContentLengthStrategy.INSTANCE,
-                new InternalConnectionListener(id, sessionLog),
-                new InternalHttp1StreamListener(id, InternalHttp1StreamListener.Type.CLIENT, sessionLog));
-        return new LoggingIOEventHandler(new ClientHttp1IOEventHandler(streamDuplexer), id, sessionLog);
+                LoggingConnectionListener.INSTANCE,
+                LoggingHttp1StreamListener.INSTANCE_CLIENT);
+        return new ClientHttp1IOEventHandler(streamDuplexer);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalClientHttp2EventHandlerFactory.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalClientHttp2EventHandlerFactory.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalClientHttp2EventHandlerFactory.java
index fcbaf8a..016b90f 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalClientHttp2EventHandlerFactory.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalClientHttp2EventHandlerFactory.java
@@ -45,8 +45,6 @@ import org.apache.hc.core5.reactor.IOEventHandler;
 import org.apache.hc.core5.reactor.IOEventHandlerFactory;
 import org.apache.hc.core5.reactor.TlsCapableIOSession;
 import org.apache.hc.core5.util.Args;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 
 class InternalClientHttp2EventHandlerFactory implements IOEventHandlerFactory {
 
@@ -77,33 +75,28 @@ class InternalClientHttp2EventHandlerFactory implements IOEventHandlerFactory {
 
     @Override
     public IOEventHandler createHandler(final TlsCapableIOSession ioSession, final Object attachment) {
-        final String id = ioSession.getId();
         if (sslContext != null) {
             ioSession.startTls(sslContext, null ,null, null);
         }
-        final Logger sessionLog = LogManager.getLogger(ioSession.getClass());
-        final LoggingIOSession loggingIOSession = new LoggingIOSession(ioSession, sessionLog);
         final ClientHttp1StreamDuplexerFactory http1StreamHandlerFactory = new ClientHttp1StreamDuplexerFactory(
                 httpProcessor != null ? httpProcessor : HttpProcessors.client(),
                 h1Config,
                 charCodingConfig,
-                new InternalConnectionListener(id, sessionLog),
-                new InternalHttp1StreamListener(id, InternalHttp1StreamListener.Type.CLIENT, sessionLog));
+                LoggingConnectionListener.INSTANCE,
+                LoggingHttp1StreamListener.INSTANCE_CLIENT);
         final ClientHttp2StreamMultiplexerFactory http2StreamHandlerFactory = new ClientHttp2StreamMultiplexerFactory(
                 httpProcessor != null ? httpProcessor : Http2Processors.client(),
                 exchangeHandlerFactory,
                 h2Config,
                 charCodingConfig,
-                new InternalConnectionListener(id, sessionLog),
-                new InternalHttp2StreamListener(id));
-        return new LoggingIOEventHandler(
-                new ClientHttpProtocolNegotiator(
-                        loggingIOSession,
+                LoggingConnectionListener.INSTANCE,
+                LoggingHttp2StreamListener.INSTANCE);
+        return new ClientHttpProtocolNegotiator(
+                        ioSession,
                         http1StreamHandlerFactory,
                         http2StreamHandlerFactory,
                         versionPolicy != null ? versionPolicy : HttpVersionPolicy.NEGOTIATE,
-                        new InternalConnectionListener(id, sessionLog)),
-                id, sessionLog);
+                        LoggingConnectionListener.INSTANCE);
    }
 
 }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalConnectionListener.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalConnectionListener.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalConnectionListener.java
deleted file mode 100644
index 5c0ef96..0000000
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalConnectionListener.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.hc.core5.testing.nio;
-
-import org.apache.hc.core5.http.ConnectionClosedException;
-import org.apache.hc.core5.http.HttpConnection;
-import org.apache.hc.core5.http.impl.ConnectionListener;
-import org.apache.logging.log4j.Logger;
-
-class InternalConnectionListener implements ConnectionListener {
-
-    private final String id;
-    private final Logger log;
-
-    public InternalConnectionListener(final String id, final Logger log) {
-        this.log = log;
-        this.id = id;
-    }
-
-    @Override
-    public void onConnect(final HttpConnection connection) {
-        if (log.isDebugEnabled()) {
-            log.debug(id + " " + connection + " connected");
-        }
-    }
-
-    @Override
-    public void onDisconnect(final HttpConnection connection) {
-        if (log.isDebugEnabled()) {
-            log.debug(id + " " + connection + " disconnected");
-        }
-    }
-
-    @Override
-    public void onError(final HttpConnection connection, final Exception ex) {
-        if (ex instanceof ConnectionClosedException) {
-            return;
-        }
-        log.error(id + " " + ex.getMessage(), ex);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalHttp1StreamListener.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalHttp1StreamListener.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalHttp1StreamListener.java
deleted file mode 100644
index 48b9608..0000000
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalHttp1StreamListener.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.hc.core5.testing.nio;
-
-import java.util.Iterator;
-
-import org.apache.hc.core5.http.Header;
-import org.apache.hc.core5.http.HttpConnection;
-import org.apache.hc.core5.http.HttpRequest;
-import org.apache.hc.core5.http.HttpResponse;
-import org.apache.hc.core5.http.impl.Http1StreamListener;
-import org.apache.hc.core5.http.message.RequestLine;
-import org.apache.hc.core5.http.message.StatusLine;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-class InternalHttp1StreamListener implements Http1StreamListener {
-
-    enum Type { CLIENT, SERVER }
-
-    private final String id;
-    private final Type type;
-    private final Logger sessionLog;
-    private final Logger headerLog = LogManager.getLogger("org.apache.hc.core5.http.headers");
-
-    public InternalHttp1StreamListener(final String id, final Type type, final Logger sessionLog) {
-        this.id = id;
-        this.type = type;
-        this.sessionLog = sessionLog;
-    }
-
-    private String requestDirection() {
-        return type == Type.CLIENT ? " >> " : " << ";
-    }
-
-    private String responseDirection() {
-        return type == Type.CLIENT ? " << " : " >> ";
-    }
-
-    @Override
-    public void onRequestHead(final HttpConnection connection, final HttpRequest request) {
-        if (headerLog.isDebugEnabled()) {
-            headerLog.debug(id + requestDirection() + new RequestLine(request));
-            for (final Iterator<Header> it = request.headerIterator(); it.hasNext(); ) {
-                headerLog.debug(id + requestDirection() + it.next());
-            }
-        }
-    }
-
-    @Override
-    public void onResponseHead(final HttpConnection connection, final HttpResponse response) {
-        if (headerLog.isDebugEnabled()) {
-            headerLog.debug(id + responseDirection() + new StatusLine(response));
-            for (final Iterator<Header> it = response.headerIterator(); it.hasNext(); ) {
-                headerLog.debug(id + responseDirection() + it.next());
-            }
-        }
-    }
-
-    @Override
-    public void onExchangeComplete(final HttpConnection connection, final boolean keepAlive) {
-        if (sessionLog.isDebugEnabled()) {
-            if (keepAlive) {
-                sessionLog.debug(id + " Connection is kept alive");
-            } else {
-                sessionLog.debug(id + " Connection is not kept alive");
-            }
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalHttp2StreamListener.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalHttp2StreamListener.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalHttp2StreamListener.java
deleted file mode 100644
index f90d544..0000000
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalHttp2StreamListener.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.hc.core5.testing.nio;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.apache.hc.core5.http.Header;
-import org.apache.hc.core5.http.HttpConnection;
-import org.apache.hc.core5.http2.frame.FramePrinter;
-import org.apache.hc.core5.http2.frame.RawFrame;
-import org.apache.hc.core5.http2.impl.nio.Http2StreamListener;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-class InternalHttp2StreamListener implements Http2StreamListener {
-
-    private final String id;
-    private final Logger headerLog;
-    private final Logger frameLog;
-    private final Logger framePayloadLog;
-    private final Logger flowCtrlLog;
-    private final FramePrinter framePrinter;
-
-    public InternalHttp2StreamListener(final String id) {
-        this.id = id;
-        this.framePrinter = new FramePrinter();
-        this.headerLog = LogManager.getLogger("org.apache.hc.core5.http.headers");
-        this.frameLog = LogManager.getLogger("org.apache.hc.core5.http2.frame");
-        this.framePayloadLog = LogManager.getLogger("org.apache.hc.core5.http2.frame.payload");
-        this.flowCtrlLog = LogManager.getLogger("org.apache.hc.core5.http2.flow");
-    }
-
-    private void logFrameInfo(final String prefix, final RawFrame frame) {
-        try {
-            final LogAppendable logAppendable = new LogAppendable(frameLog, prefix);
-            framePrinter.printFrameInfo(frame, logAppendable);
-            logAppendable.flush();
-        } catch (final IOException ignore) {
-        }
-    }
-
-    private void logFramePayload(final String prefix, final RawFrame frame) {
-        try {
-            final LogAppendable logAppendable = new LogAppendable(framePayloadLog, prefix);
-            framePrinter.printPayload(frame, logAppendable);
-            logAppendable.flush();
-        } catch (final IOException ignore) {
-        }
-    }
-
-    private void logFlowControl(final String prefix, final int streamId, final int delta, final int actualSize) {
-        final StringBuilder buffer = new StringBuilder();
-        buffer.append(prefix).append(" stream ").append(streamId).append(" flow control " )
-                .append(delta).append(" -> ")
-                .append(actualSize);
-        flowCtrlLog.debug(buffer.toString());
-    }
-
-    @Override
-    public void onHeaderInput(final HttpConnection connection, final int streamId, final List<? extends Header> headers) {
-        if (headerLog.isDebugEnabled()) {
-            for (int i = 0; i < headers.size(); i++) {
-                headerLog.debug(id + " << " + headers.get(i));
-            }
-        }
-    }
-
-    @Override
-    public void onHeaderOutput(final HttpConnection connection, final int streamId, final List<? extends Header> headers) {
-        if (headerLog.isDebugEnabled()) {
-            for (int i = 0; i < headers.size(); i++) {
-                headerLog.debug(id + " >> " + headers.get(i));
-            }
-        }
-    }
-
-    @Override
-    public void onFrameInput(final HttpConnection connection, final int streamId, final RawFrame frame) {
-        if (frameLog.isDebugEnabled()) {
-            logFrameInfo(id + " <<", frame);
-        }
-        if (framePayloadLog.isDebugEnabled()) {
-            logFramePayload(id + " <<", frame);
-        }
-    }
-
-    @Override
-    public void onFrameOutput(final HttpConnection connection, final int streamId, final RawFrame frame) {
-        if (frameLog.isDebugEnabled()) {
-            logFrameInfo(id + " >>", frame);
-        }
-        if (framePayloadLog.isDebugEnabled()) {
-            logFramePayload(id + " >>", frame);
-        }
-    }
-
-    @Override
-    public void onInputFlowControl(final HttpConnection connection, final int streamId, final int delta, final int actualSize) {
-        if (flowCtrlLog.isDebugEnabled()) {
-            logFlowControl(id + " <<", streamId, delta, actualSize);
-        }
-    }
-
-    @Override
-    public void onOutputFlowControl(final HttpConnection connection, final int streamId, final int delta, final int actualSize) {
-        if (flowCtrlLog.isDebugEnabled()) {
-            logFlowControl(id + " >>", streamId, delta, actualSize);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalServerHttp1EventHandlerFactory.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalServerHttp1EventHandlerFactory.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalServerHttp1EventHandlerFactory.java
index 44fdb79..19a1eca 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalServerHttp1EventHandlerFactory.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalServerHttp1EventHandlerFactory.java
@@ -57,8 +57,6 @@ import org.apache.hc.core5.reactor.IOEventHandler;
 import org.apache.hc.core5.reactor.IOEventHandlerFactory;
 import org.apache.hc.core5.reactor.TlsCapableIOSession;
 import org.apache.hc.core5.util.Args;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 
 /**
  * @since 5.0
@@ -114,15 +112,11 @@ class InternalServerHttp1EventHandlerFactory implements IOEventHandlerFactory {
 
     @Override
     public IOEventHandler createHandler(final TlsCapableIOSession ioSession, final Object attachment) {
-        final String id = ioSession.getId();
         if (sslContext != null) {
             ioSession.startTls(sslContext, null ,null, null);
         }
-        final Logger sessionLog = LogManager.getLogger(ioSession.getClass());
-        final Logger wireLog = LogManager.getLogger("org.apache.hc.core5.http.wire");
-
         final ServerHttp1StreamDuplexer streamDuplexer = createServerHttp1StreamDuplexer(
-                new LoggingIOSession(ioSession, sessionLog, wireLog),
+                ioSession,
                 httpProcessor,
                 exchangeHandlerFactory,
                 h1Config,
@@ -132,9 +126,9 @@ class InternalServerHttp1EventHandlerFactory implements IOEventHandlerFactory {
                 responseWriterFactory.create(),
                 DefaultContentLengthStrategy.INSTANCE,
                 DefaultContentLengthStrategy.INSTANCE,
-                new InternalConnectionListener(id, sessionLog),
-                new InternalHttp1StreamListener(id, InternalHttp1StreamListener.Type.SERVER, sessionLog));
-        return new LoggingIOEventHandler(new ServerHttp1IOEventHandler(streamDuplexer), id, sessionLog);
+                LoggingConnectionListener.INSTANCE,
+                LoggingHttp1StreamListener.INSTANCE_SERVER);
+        return new ServerHttp1IOEventHandler(streamDuplexer);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalServerHttp2EventHandlerFactory.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalServerHttp2EventHandlerFactory.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalServerHttp2EventHandlerFactory.java
index 4a69374..79162b7 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalServerHttp2EventHandlerFactory.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/InternalServerHttp2EventHandlerFactory.java
@@ -45,8 +45,6 @@ import org.apache.hc.core5.reactor.IOEventHandler;
 import org.apache.hc.core5.reactor.IOEventHandlerFactory;
 import org.apache.hc.core5.reactor.TlsCapableIOSession;
 import org.apache.hc.core5.util.Args;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 
 class InternalServerHttp2EventHandlerFactory implements IOEventHandlerFactory {
 
@@ -77,34 +75,29 @@ class InternalServerHttp2EventHandlerFactory implements IOEventHandlerFactory {
 
     @Override
     public IOEventHandler createHandler(final TlsCapableIOSession ioSession, final Object attachment) {
-        final String id = ioSession.getId();
         if (sslContext != null) {
             ioSession.startTls(sslContext, null ,null, null);
         }
-        final Logger sessionLog = LogManager.getLogger(ioSession.getClass());
-        final LoggingIOSession loggingIOSession = new LoggingIOSession(ioSession, sessionLog);
         final ServerHttp1StreamDuplexerFactory http1StreamHandlerFactory = new ServerHttp1StreamDuplexerFactory(
                 httpProcessor != null ? httpProcessor : HttpProcessors.server(),
                 exchangeHandlerFactory,
                 h1Config,
                 charCodingConfig,
-                new InternalConnectionListener(id, sessionLog),
-                new InternalHttp1StreamListener(id, InternalHttp1StreamListener.Type.SERVER, sessionLog));
+                LoggingConnectionListener.INSTANCE,
+                LoggingHttp1StreamListener.INSTANCE_SERVER);
         final ServerHttp2StreamMultiplexerFactory http2StreamHandlerFactory = new ServerHttp2StreamMultiplexerFactory(
                 httpProcessor != null ? httpProcessor : Http2Processors.server(),
                 exchangeHandlerFactory,
                 h2Config,
                 charCodingConfig,
-                new InternalConnectionListener(id, sessionLog),
-                new InternalHttp2StreamListener(id));
-        return new LoggingIOEventHandler(
-                new ServerHttpProtocolNegotiator(
-                        loggingIOSession,
+                LoggingConnectionListener.INSTANCE,
+                LoggingHttp2StreamListener.INSTANCE);
+        return new ServerHttpProtocolNegotiator(
+                        ioSession,
                         http1StreamHandlerFactory,
                         http2StreamHandlerFactory,
                         versionPolicy,
-                        new InternalConnectionListener(id, sessionLog)),
-                id, sessionLog);
+                        LoggingConnectionListener.INSTANCE);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingConnPoolListener.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingConnPoolListener.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingConnPoolListener.java
new file mode 100644
index 0000000..901667d
--- /dev/null
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingConnPoolListener.java
@@ -0,0 +1,72 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.hc.core5.testing.nio;
+
+import org.apache.hc.core5.http.HttpHost;
+import org.apache.hc.core5.pool.ConnPoolListener;
+import org.apache.hc.core5.pool.ConnPoolStats;
+import org.apache.hc.core5.pool.PoolStats;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+public class LoggingConnPoolListener implements ConnPoolListener<HttpHost> {
+
+    public final static LoggingConnPoolListener INSTANCE = new LoggingConnPoolListener();
+
+    private final Logger connLog = LogManager.getLogger("org.apache.hc.core5.http.connection");
+
+    private LoggingConnPoolListener() {
+    }
+
+    @Override
+    public void onLease(final HttpHost route, final ConnPoolStats<HttpHost> connPoolStats) {
+        if (connLog.isDebugEnabled()) {
+            final StringBuilder buf = new StringBuilder();
+            buf.append("Leased ").append(route).append(" ");
+            final PoolStats totals = connPoolStats.getTotalStats();
+            buf.append(" total kept alive: ").append(totals.getAvailable()).append("; ");
+            buf.append("total allocated: ").append(totals.getLeased() + totals.getAvailable());
+            buf.append(" of ").append(totals.getMax());
+            connLog.debug(buf.toString());
+        }
+    }
+
+    @Override
+    public void onRelease(final HttpHost route, final ConnPoolStats<HttpHost> connPoolStats) {
+        if (connLog.isDebugEnabled()) {
+            final StringBuilder buf = new StringBuilder();
+            buf.append("Released ").append(route).append(" ");
+            final PoolStats totals = connPoolStats.getTotalStats();
+            buf.append(" total kept alive: ").append(totals.getAvailable()).append("; ");
+            buf.append("total allocated: ").append(totals.getLeased() + totals.getAvailable());
+            buf.append(" of ").append(totals.getMax());
+            connLog.debug(buf.toString());
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingConnectionListener.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingConnectionListener.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingConnectionListener.java
new file mode 100644
index 0000000..e8c0ea8
--- /dev/null
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingConnectionListener.java
@@ -0,0 +1,67 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.hc.core5.testing.nio;
+
+import org.apache.hc.core5.http.ConnectionClosedException;
+import org.apache.hc.core5.http.HttpConnection;
+import org.apache.hc.core5.http.impl.ConnectionListener;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+public class LoggingConnectionListener implements ConnectionListener {
+
+    public final static LoggingConnectionListener INSTANCE = new LoggingConnectionListener();
+
+    private final Logger connLog = LogManager.getLogger("org.apache.hc.core5.http.connection");
+
+    private LoggingConnectionListener() {
+    }
+
+    @Override
+    public void onConnect(final HttpConnection connection) {
+        if (connLog.isDebugEnabled()) {
+            connLog.debug(LoggingSupport.getId(connection) + " " + connection + " connected");
+        }
+    }
+
+    @Override
+    public void onDisconnect(final HttpConnection connection) {
+        if (connLog.isDebugEnabled()) {
+            connLog.debug(LoggingSupport.getId(connection) + " " + connection + " disconnected");
+        }
+    }
+
+    @Override
+    public void onError(final HttpConnection connection, final Exception ex) {
+        if (ex instanceof ConnectionClosedException) {
+            return;
+        }
+        connLog.error(LoggingSupport.getId(connection) + " " + ex.getMessage(), ex);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingHttp1StreamListener.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingHttp1StreamListener.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingHttp1StreamListener.java
new file mode 100644
index 0000000..4b0d324
--- /dev/null
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingHttp1StreamListener.java
@@ -0,0 +1,96 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.hc.core5.testing.nio;
+
+import java.util.Iterator;
+
+import org.apache.hc.core5.http.Header;
+import org.apache.hc.core5.http.HttpConnection;
+import org.apache.hc.core5.http.HttpRequest;
+import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.impl.Http1StreamListener;
+import org.apache.hc.core5.http.message.RequestLine;
+import org.apache.hc.core5.http.message.StatusLine;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+public class LoggingHttp1StreamListener implements Http1StreamListener {
+
+    enum Type { CLIENT, SERVER }
+
+    final static LoggingHttp1StreamListener INSTANCE_CLIENT = new LoggingHttp1StreamListener(Type.CLIENT);
+    final static LoggingHttp1StreamListener INSTANCE_SERVER = new LoggingHttp1StreamListener(Type.SERVER);
+
+    private final Type type;
+    private final Logger connLog = LogManager.getLogger("org.apache.hc.core5.http.connection");
+    private final Logger headerLog = LogManager.getLogger("org.apache.hc.core5.http.headers");
+
+    private LoggingHttp1StreamListener(final Type type) {
+        this.type = type;
+    }
+
+    private String requestDirection() {
+        return type == Type.CLIENT ? " >> " : " << ";
+    }
+
+    private String responseDirection() {
+        return type == Type.CLIENT ? " << " : " >> ";
+    }
+
+    @Override
+    public void onRequestHead(final HttpConnection connection, final HttpRequest request) {
+        if (headerLog.isDebugEnabled()) {
+            headerLog.debug(LoggingSupport.getId(connection) + requestDirection() + new RequestLine(request));
+            for (final Iterator<Header> it = request.headerIterator(); it.hasNext(); ) {
+                headerLog.debug(LoggingSupport.getId(connection) + requestDirection() + it.next());
+            }
+        }
+    }
+
+    @Override
+    public void onResponseHead(final HttpConnection connection, final HttpResponse response) {
+        if (headerLog.isDebugEnabled()) {
+            headerLog.debug(LoggingSupport.getId(connection) + responseDirection() + new StatusLine(response));
+            for (final Iterator<Header> it = response.headerIterator(); it.hasNext(); ) {
+                headerLog.debug(LoggingSupport.getId(connection) + responseDirection() + it.next());
+            }
+        }
+    }
+
+    @Override
+    public void onExchangeComplete(final HttpConnection connection, final boolean keepAlive) {
+        if (connLog.isDebugEnabled()) {
+            if (keepAlive) {
+                connLog.debug(LoggingSupport.getId(connection) + " Connection is kept alive");
+            } else {
+                connLog.debug(LoggingSupport.getId(connection) + " Connection is not kept alive");
+            }
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingHttp2StreamListener.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingHttp2StreamListener.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingHttp2StreamListener.java
new file mode 100644
index 0000000..84f726f
--- /dev/null
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingHttp2StreamListener.java
@@ -0,0 +1,137 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.hc.core5.testing.nio;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.hc.core5.http.Header;
+import org.apache.hc.core5.http.HttpConnection;
+import org.apache.hc.core5.http2.frame.FramePrinter;
+import org.apache.hc.core5.http2.frame.RawFrame;
+import org.apache.hc.core5.http2.impl.nio.Http2StreamListener;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+public class LoggingHttp2StreamListener implements Http2StreamListener {
+
+    public final static LoggingHttp2StreamListener INSTANCE = new LoggingHttp2StreamListener();
+
+    private final Logger headerLog;
+    private final Logger frameLog;
+    private final Logger framePayloadLog;
+    private final Logger flowCtrlLog;
+    private final FramePrinter framePrinter;
+
+    private LoggingHttp2StreamListener() {
+        this.framePrinter = new FramePrinter();
+        this.headerLog = LogManager.getLogger("org.apache.hc.core5.http.headers");
+        this.frameLog = LogManager.getLogger("org.apache.hc.core5.http2.frame");
+        this.framePayloadLog = LogManager.getLogger("org.apache.hc.core5.http2.frame.payload");
+        this.flowCtrlLog = LogManager.getLogger("org.apache.hc.core5.http2.flow");
+    }
+
+    private void logFrameInfo(final String prefix, final RawFrame frame) {
+        try {
+            final LogAppendable logAppendable = new LogAppendable(frameLog, prefix);
+            framePrinter.printFrameInfo(frame, logAppendable);
+            logAppendable.flush();
+        } catch (final IOException ignore) {
+        }
+    }
+
+    private void logFramePayload(final String prefix, final RawFrame frame) {
+        try {
+            final LogAppendable logAppendable = new LogAppendable(framePayloadLog, prefix);
+            framePrinter.printPayload(frame, logAppendable);
+            logAppendable.flush();
+        } catch (final IOException ignore) {
+        }
+    }
+
+    private void logFlowControl(final String prefix, final int streamId, final int delta, final int actualSize) {
+        final StringBuilder buffer = new StringBuilder();
+        buffer.append(prefix).append(" stream ").append(streamId).append(" flow control " )
+                .append(delta).append(" -> ")
+                .append(actualSize);
+        flowCtrlLog.debug(buffer.toString());
+    }
+
+    @Override
+    public void onHeaderInput(final HttpConnection connection, final int streamId, final List<? extends Header> headers) {
+        if (headerLog.isDebugEnabled()) {
+            for (int i = 0; i < headers.size(); i++) {
+                headerLog.debug(LoggingSupport.getId(connection) + " << " + headers.get(i));
+            }
+        }
+    }
+
+    @Override
+    public void onHeaderOutput(final HttpConnection connection, final int streamId, final List<? extends Header> headers) {
+        if (headerLog.isDebugEnabled()) {
+            for (int i = 0; i < headers.size(); i++) {
+                headerLog.debug(LoggingSupport.getId(connection) + " >> " + headers.get(i));
+            }
+        }
+    }
+
+    @Override
+    public void onFrameInput(final HttpConnection connection, final int streamId, final RawFrame frame) {
+        if (frameLog.isDebugEnabled()) {
+            logFrameInfo(LoggingSupport.getId(connection) + " <<", frame);
+        }
+        if (framePayloadLog.isDebugEnabled()) {
+            logFramePayload(LoggingSupport.getId(connection) + " <<", frame);
+        }
+    }
+
+    @Override
+    public void onFrameOutput(final HttpConnection connection, final int streamId, final RawFrame frame) {
+        if (frameLog.isDebugEnabled()) {
+            logFrameInfo(LoggingSupport.getId(connection) + " >>", frame);
+        }
+        if (framePayloadLog.isDebugEnabled()) {
+            logFramePayload(LoggingSupport.getId(connection) + " >>", frame);
+        }
+    }
+
+    @Override
+    public void onInputFlowControl(final HttpConnection connection, final int streamId, final int delta, final int actualSize) {
+        if (flowCtrlLog.isDebugEnabled()) {
+            logFlowControl(LoggingSupport.getId(connection) + " <<", streamId, delta, actualSize);
+        }
+    }
+
+    @Override
+    public void onOutputFlowControl(final HttpConnection connection, final int streamId, final int delta, final int actualSize) {
+        if (flowCtrlLog.isDebugEnabled()) {
+            logFlowControl(LoggingSupport.getId(connection) + " >>", streamId, delta, actualSize);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOEventHandler.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOEventHandler.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOEventHandler.java
index 0f129c9..af874d9 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOEventHandler.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOEventHandler.java
@@ -41,16 +41,11 @@ import org.apache.logging.log4j.Logger;
 public class LoggingIOEventHandler implements HttpConnectionEventHandler {
 
     private final HttpConnectionEventHandler handler;
-    private final String id;
     private final Logger log;
 
-    public LoggingIOEventHandler(
-            final HttpConnectionEventHandler handler,
-            final String id,
-            final Logger log) {
+    public LoggingIOEventHandler(final HttpConnectionEventHandler handler, final Logger log) {
         super();
         this.handler = handler;
-        this.id = id;
         this.log = log;
     }
 
@@ -111,9 +106,6 @@ public class LoggingIOEventHandler implements HttpConnectionEventHandler {
 
     @Override
     public void setSocketTimeout(final int timeout) {
-        if (log.isDebugEnabled()) {
-            log.debug(id + " set timeout " + timeout);
-        }
         handler.setSocketTimeout(timeout);
     }
 
@@ -144,17 +136,11 @@ public class LoggingIOEventHandler implements HttpConnectionEventHandler {
 
     @Override
     public void close() throws IOException {
-        if (log.isDebugEnabled()) {
-            log.debug(id + " close");
-        }
         handler.close();
     }
 
     @Override
     public void shutdown(final ShutdownType shutdownType) {
-        if (log.isDebugEnabled()) {
-            log.debug(id + " shutdown");
-        }
         handler.shutdown(shutdownType);
     }
 

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSession.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSession.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSession.java
index 5ddefe0..0a4770c 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSession.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSession.java
@@ -33,26 +33,21 @@ import java.nio.ByteBuffer;
 import java.nio.channels.ByteChannel;
 import java.nio.channels.SelectionKey;
 
-import javax.net.ssl.SSLContext;
-
+import org.apache.hc.core5.http.impl.nio.HttpConnectionEventHandler;
 import org.apache.hc.core5.io.ShutdownType;
 import org.apache.hc.core5.reactor.Command;
 import org.apache.hc.core5.reactor.IOEventHandler;
-import org.apache.hc.core5.reactor.TlsCapableIOSession;
-import org.apache.hc.core5.reactor.ssl.SSLBufferManagement;
-import org.apache.hc.core5.reactor.ssl.SSLSessionInitializer;
-import org.apache.hc.core5.reactor.ssl.SSLSessionVerifier;
-import org.apache.hc.core5.reactor.ssl.TlsDetails;
+import org.apache.hc.core5.reactor.IOSession;
 import org.apache.hc.core5.testing.classic.Wire;
 import org.apache.logging.log4j.Logger;
-public class LoggingIOSession implements TlsCapableIOSession {
+public class LoggingIOSession implements IOSession {
 
     private final Logger log;
     private final Wire wirelog;
-    private final TlsCapableIOSession session;
+    private final IOSession session;
     private final ByteChannel channel;
 
-    public LoggingIOSession(final TlsCapableIOSession session, final Logger log, final Logger wirelog) {
+    public LoggingIOSession(final IOSession session, final Logger log, final Logger wirelog) {
         super();
         this.session = session;
         this.log = log;
@@ -60,7 +55,7 @@ public class LoggingIOSession implements TlsCapableIOSession {
         this.channel = wirelog != null ? new LoggingByteChannel() : session.channel();
     }
 
-    public LoggingIOSession(final TlsCapableIOSession session, final Logger log) {
+    public LoggingIOSession(final IOSession session, final Logger log) {
         this(session, log, null);
     }
 
@@ -72,11 +67,17 @@ public class LoggingIOSession implements TlsCapableIOSession {
     @Override
     public void addLast(final Command command) {
         this.session.addLast(command);
+        if (this.log.isDebugEnabled()) {
+            this.log.debug(command.getClass().getSimpleName() + " added last");
+        }
     }
 
     @Override
     public void addFirst(final Command command) {
         this.session.addFirst(command);
+        if (this.log.isDebugEnabled()) {
+            this.log.debug(command.getClass().getSimpleName() + " added first");
+        }
     }
 
     @Override
@@ -168,7 +169,7 @@ public class LoggingIOSession implements TlsCapableIOSession {
     @Override
     public void shutdown(final ShutdownType shutdownType) {
         if (this.log.isDebugEnabled()) {
-            this.log.debug(this.session + " Shutdown");
+            this.log.debug(this.session + " Shutdown " + shutdownType);
         }
         this.session.shutdown(shutdownType);
     }
@@ -193,21 +194,11 @@ public class LoggingIOSession implements TlsCapableIOSession {
 
     @Override
     public void setHandler(final IOEventHandler handler) {
-        this.session.setHandler(handler);
-    }
-
-    @Override
-    public TlsDetails getTlsDetails() {
-        return session.getTlsDetails();
-    }
-
-    @Override
-    public void startTls(
-            final SSLContext sslContext,
-            final SSLBufferManagement sslBufferManagement,
-            final SSLSessionInitializer initializer,
-            final SSLSessionVerifier verifier) throws UnsupportedOperationException {
-        session.startTls(sslContext, sslBufferManagement, initializer, verifier);
+        if (handler instanceof HttpConnectionEventHandler) {
+            this.session.setHandler(new LoggingIOEventHandler((HttpConnectionEventHandler) handler, log));
+        } else {
+            this.session.setHandler(handler);
+        }
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSessionDecorator.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSessionDecorator.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSessionDecorator.java
new file mode 100644
index 0000000..eb713ed
--- /dev/null
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSessionDecorator.java
@@ -0,0 +1,49 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.hc.core5.testing.nio;
+
+import org.apache.hc.core5.function.Decorator;
+import org.apache.hc.core5.reactor.IOSession;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+public class LoggingIOSessionDecorator implements Decorator<IOSession> {
+
+    public final static LoggingIOSessionDecorator INSTANCE = new LoggingIOSessionDecorator();
+
+    private final Logger wireLog = LogManager.getLogger("org.apache.hc.core5.http.wire");
+
+    private LoggingIOSessionDecorator() {
+    }
+
+    @Override
+    public IOSession decorate(final IOSession ioSession) {
+        final Logger sessionLog = LogManager.getLogger(ioSession.getClass());
+        return new LoggingIOSession(ioSession, sessionLog, wireLog);
+    }
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingSupport.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingSupport.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingSupport.java
new file mode 100644
index 0000000..51fd637
--- /dev/null
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingSupport.java
@@ -0,0 +1,44 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+package org.apache.hc.core5.testing.nio;
+
+import org.apache.hc.core5.util.Identifiable;
+
+final class LoggingSupport {
+
+    static String getId(final Object object) {
+        if (object == null) {
+            return null;
+        }
+        if (object instanceof Identifiable) {
+            return ((Identifiable) object).getId();
+        } else {
+            return object.getClass().getSimpleName() + "-" + Integer.toHexString(System.identityHashCode(object));
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/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 5c3ff49..20480a5 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
@@ -141,6 +141,8 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public class Http1IntegrationTest extends InternalHttp1ServerTestBase {
 
+    private final Logger log = LogManager.getLogger(getClass());
+
     @Parameterized.Parameters(name = "{0}")
     public static Collection<Object[]> protocols() {
         return Arrays.asList(new Object[][]{
@@ -160,6 +162,7 @@ public class Http1IntegrationTest extends InternalHttp1ServerTestBase {
 
     @Before
     public void setup() throws Exception {
+        log.debug("Starting up test client");
         client = new Http1TestClient(
                 IOReactorConfig.DEFAULT,
                 scheme == URIScheme.HTTPS ? SSLTestContexts.createClientSSLContext() : null);
@@ -167,11 +170,11 @@ public class Http1IntegrationTest extends InternalHttp1ServerTestBase {
 
     @After
     public void cleanup() throws Exception {
+        log.debug("Shutting down test client");
         if (client != null) {
             client.shutdown(TimeValue.ofSeconds(5));
             final List<ExceptionEvent> exceptionLog = client.getExceptionLog();
             if (!exceptionLog.isEmpty()) {
-                final Logger log = LogManager.getLogger(getClass());
                 for (final ExceptionEvent event: exceptionLog) {
                     final Throwable cause = event.getCause();
                     log.error("Unexpected " + cause.getClass() + " at " + event.getTimestamp(), cause);

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1ServerAndRequesterTest.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1ServerAndRequesterTest.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1ServerAndRequesterTest.java
index 86bf875..9f2ccb9 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1ServerAndRequesterTest.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http1ServerAndRequesterTest.java
@@ -74,6 +74,8 @@ public class Http1ServerAndRequesterTest {
 
     private static final TimeValue TIMEOUT = TimeValue.ofSeconds(30);
 
+    private final Logger log = LogManager.getLogger(getClass());
+
     private HttpAsyncServer server;
 
     @Rule
@@ -81,6 +83,7 @@ public class Http1ServerAndRequesterTest {
 
         @Override
         protected void before() throws Throwable {
+            log.debug("Starting up test server");
             server = AsyncServerBootstrap.bootstrap()
                     .setIOReactorConfig(
                             IOReactorConfig.custom()
@@ -133,18 +136,21 @@ public class Http1ServerAndRequesterTest {
                         }
 
                     })
+                    .setConnectionListener(LoggingConnectionListener.INSTANCE)
+                    .setStreamListener(LoggingHttp1StreamListener.INSTANCE_SERVER)
+                    .setIOSessionDecorator(LoggingIOSessionDecorator.INSTANCE)
                     .create();
         }
 
         @Override
         protected void after() {
+            log.debug("Shutting down test server");
             if (server != null) {
                 try {
                     server.shutdown(ShutdownType.GRACEFUL);
                     final List<ExceptionEvent> exceptionLog = server.getExceptionLog();
                     server = null;
                     if (!exceptionLog.isEmpty()) {
-                        final Logger log = LogManager.getLogger(getClass());
                         for (final ExceptionEvent event: exceptionLog) {
                             final Throwable cause = event.getCause();
                             log.error("Unexpected " + cause.getClass() + " at " + event.getTimestamp(), cause);
@@ -164,22 +170,27 @@ public class Http1ServerAndRequesterTest {
 
         @Override
         protected void before() throws Throwable {
+            log.debug("Starting up test client");
             requester = AsyncRequesterBootstrap.bootstrap()
                     .setIOReactorConfig(IOReactorConfig.custom()
                             .setSoTimeout(TIMEOUT)
                             .build())
+                    .setConnectionListener(LoggingConnectionListener.INSTANCE)
+                    .setStreamListener(LoggingHttp1StreamListener.INSTANCE_CLIENT)
+                    .setConnPoolListener(LoggingConnPoolListener.INSTANCE)
+                    .setIOSessionDecorator(LoggingIOSessionDecorator.INSTANCE)
                     .create();
         }
 
         @Override
         protected void after() {
+            log.debug("Shutting down test client");
             if (requester != null) {
                 try {
                     requester.shutdown(ShutdownType.GRACEFUL);
                     final List<ExceptionEvent> exceptionLog = requester.getExceptionLog();
                     requester = null;
                     if (!exceptionLog.isEmpty()) {
-                        final Logger log = LogManager.getLogger(getClass());
                         for (final ExceptionEvent event: exceptionLog) {
                             final Throwable cause = event.getCause();
                             log.error("Unexpected " + cause.getClass() + " at " + event.getTimestamp(), cause);

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/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 7d75400..22f8c72 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
@@ -127,6 +127,8 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public class Http2IntegrationTest extends InternalHttp2ServerTestBase {
 
+    private final Logger log = LogManager.getLogger(getClass());
+
     @Parameterized.Parameters(name = "{0}")
     public static Collection<Object[]> protocols() {
         return Arrays.asList(new Object[][]{
@@ -146,17 +148,18 @@ public class Http2IntegrationTest extends InternalHttp2ServerTestBase {
 
     @Before
     public void setup() throws Exception {
+        log.debug("Starting up test client");
         client = new Http2TestClient(IOReactorConfig.DEFAULT,
                 scheme == URIScheme.HTTPS ? SSLTestContexts.createClientSSLContext() : null);
     }
 
     @After
     public void cleanup() throws Exception {
+        log.debug("Shutting down test client");
         if (client != null) {
             client.shutdown(TimeValue.ofSeconds(5));
             final List<ExceptionEvent> exceptionLog = client.getExceptionLog();
             if (!exceptionLog.isEmpty()) {
-                final Logger log = LogManager.getLogger(getClass());
                 for (final ExceptionEvent event: exceptionLog) {
                     final Throwable cause = event.getCause();
                     log.error("Unexpected " + cause.getClass() + " at " + event.getTimestamp(), cause);

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/41b47a5e/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http2ProtocolNegotiationTest.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http2ProtocolNegotiationTest.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http2ProtocolNegotiationTest.java
index a549aa6..d097b09 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http2ProtocolNegotiationTest.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/Http2ProtocolNegotiationTest.java
@@ -75,6 +75,8 @@ public class Http2ProtocolNegotiationTest {
 
     private static final TimeValue TIMEOUT = TimeValue.ofSeconds(30);
 
+    private final Logger log = LogManager.getLogger(getClass());
+
     private HttpAsyncServer server;
 
     @Rule
@@ -82,6 +84,7 @@ public class Http2ProtocolNegotiationTest {
 
         @Override
         protected void before() throws Throwable {
+            log.debug("Starting up test server");
             server = H2ServerBootstrap.bootstrap()
                     .setTlsStrategy(new H2ServerTlsStrategy(SSLTestContexts.createServerSSLContext(), new SecurePortStrategy() {
 
@@ -104,19 +107,22 @@ public class Http2ProtocolNegotiationTest {
                         }
 
                     })
-                    .setConnectionListener(new InternalConnectionListener("test", LogManager.getLogger(getClass())))
+                    .setConnectionListener(LoggingConnectionListener.INSTANCE)
+                    .setStreamListener(LoggingHttp2StreamListener.INSTANCE)
+                    .setStreamListener(LoggingHttp1StreamListener.INSTANCE_SERVER)
+                    .setIOSessionDecorator(LoggingIOSessionDecorator.INSTANCE)
                     .create();
         }
 
         @Override
         protected void after() {
+            log.debug("Shutting down test server");
             if (server != null) {
                 try {
                     server.shutdown(ShutdownType.GRACEFUL);
                     final List<ExceptionEvent> exceptionLog = server.getExceptionLog();
                     server = null;
                     if (!exceptionLog.isEmpty()) {
-                        final Logger log = LogManager.getLogger(getClass());
                         for (final ExceptionEvent event: exceptionLog) {
                             final Throwable cause = event.getCause();
                             log.error("Unexpected " + cause.getClass() + " at " + event.getTimestamp(), cause);
@@ -136,24 +142,30 @@ public class Http2ProtocolNegotiationTest {
 
         @Override
         protected void before() throws Throwable {
+            log.debug("Starting up test client");
             requester = H2RequesterBootstrap.bootstrap()
                     .setTlsStrategy(new H2ClientTlsStrategy(SSLTestContexts.createClientSSLContext()))
                     .setVersionPolicy(HttpVersionPolicy.NEGOTIATE)
                     .setIOReactorConfig(IOReactorConfig.custom()
                             .setSoTimeout(TIMEOUT)
                             .build())
+                    .setConnectionListener(LoggingConnectionListener.INSTANCE)
+                    .setStreamListener(LoggingHttp2StreamListener.INSTANCE)
+                    .setStreamListener(LoggingHttp1StreamListener.INSTANCE_CLIENT)
+                    .setConnPoolListener(LoggingConnPoolListener.INSTANCE)
+                    .setIOSessionDecorator(LoggingIOSessionDecorator.INSTANCE)
                     .create();
         }
 
         @Override
         protected void after() {
+            log.debug("Shutting down test client");
             if (requester != null) {
                 try {
                     requester.shutdown(ShutdownType.GRACEFUL);
                     final List<ExceptionEvent> exceptionLog = requester.getExceptionLog();
                     requester = null;
                     if (!exceptionLog.isEmpty()) {
-                        final Logger log = LogManager.getLogger(getClass());
                         for (final ExceptionEvent event: exceptionLog) {
                             final Throwable cause = event.getCause();
                             log.error("Unexpected " + cause.getClass() + " at " + event.getTimestamp(), cause);


Mime
View raw message