You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2017/04/01 17:11:31 UTC

svn commit: r1789823 - in /httpcomponents/httpcore/trunk/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic: ClassicTestClient.java LoggingBHttpClientConnection.java LoggingBHttpServerConnection.java

Author: olegk
Date: Sat Apr  1 17:11:31 2017
New Revision: 1789823

URL: http://svn.apache.org/viewvc?rev=1789823&view=rev
Log:
Fixed logging categories for classic test server and client; fixed logging in classic test client

Modified:
    httpcomponents/httpcore/trunk/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestClient.java
    httpcomponents/httpcore/trunk/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/LoggingBHttpClientConnection.java
    httpcomponents/httpcore/trunk/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/LoggingBHttpServerConnection.java

Modified: httpcomponents/httpcore/trunk/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestClient.java?rev=1789823&r1=1789822&r2=1789823&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestClient.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestClient.java Sat Apr  1 17:11:31 2017
@@ -36,9 +36,10 @@ import org.apache.hc.core5.http.ClassicH
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpHost;
 import org.apache.hc.core5.http.config.H1Config;
-import org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection;
 import org.apache.hc.core5.http.impl.bootstrap.HttpRequester;
 import org.apache.hc.core5.http.impl.bootstrap.RequesterBootstrap;
+import org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection;
+import org.apache.hc.core5.http.io.HttpConnectionFactory;
 import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.http.protocol.HttpProcessor;
 import org.apache.hc.core5.net.URIAuthority;
@@ -56,7 +57,7 @@ public class ClassicTestClient {
 
     public ClassicTestClient() {
         super();
-        this.connection = new DefaultBHttpClientConnection(H1Config.DEFAULT);
+        this.connection = new LoggingBHttpClientConnection(H1Config.DEFAULT);
     }
 
     public void setHttpProcessor(final HttpProcessor httpProcessor) {
@@ -75,6 +76,7 @@ public class ClassicTestClient {
         Asserts.check(this.requester == null, "Client already running");
         this.requester = RequesterBootstrap.bootstrap()
                 .setHttpProcessor(httpProcessor)
+                .setConnectFactory(new LoggingConnFactory())
                 .create();
 
     }
@@ -115,4 +117,13 @@ public class ClassicTestClient {
         return this.requester.keepAlive(this.connection, request, response, context);
     }
 
+    class LoggingConnFactory implements HttpConnectionFactory<LoggingBHttpClientConnection> {
+
+        @Override
+        public LoggingBHttpClientConnection createConnection(final Socket socket) throws IOException {
+            final LoggingBHttpClientConnection conn = new LoggingBHttpClientConnection(H1Config.DEFAULT);
+            conn.bind(socket);
+            return conn;
+        }
+    }
 }

Modified: httpcomponents/httpcore/trunk/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/LoggingBHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/LoggingBHttpClientConnection.java?rev=1789823&r1=1789822&r2=1789823&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/LoggingBHttpClientConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/LoggingBHttpClientConnection.java Sat Apr  1 17:11:31 2017
@@ -71,8 +71,8 @@ public class LoggingBHttpClientConnectio
                 requestWriterFactory, responseParserFactory);
         this.id = "http-outgoing-" + COUNT.incrementAndGet();
         this.log = LogManager.getLogger(getClass());
-        this.headerlog = LogManager.getLogger("org.apache.http.headers");
-        this.wire = new Wire(LogManager.getLogger("org.apache.http.wire"), this.id);
+        this.headerlog = LogManager.getLogger("org.apache.hc.core5.http.headers");
+        this.wire = new Wire(LogManager.getLogger("org.apache.hc.core5.http.wire"), this.id);
     }
 
     public LoggingBHttpClientConnection(final H1Config h1Config) {

Modified: httpcomponents/httpcore/trunk/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/LoggingBHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/LoggingBHttpServerConnection.java?rev=1789823&r1=1789822&r2=1789823&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/LoggingBHttpServerConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/LoggingBHttpServerConnection.java Sat Apr  1 17:11:31 2017
@@ -70,8 +70,8 @@ public class LoggingBHttpServerConnectio
                 requestParserFactory, responseWriterFactory);
         this.id = "http-incoming-" + COUNT.incrementAndGet();
         this.log = LogManager.getLogger(getClass());
-        this.headerlog = LogManager.getLogger("org.apache.http.headers");
-        this.wire = new Wire(LogManager.getLogger("org.apache.http.wire"), this.id);
+        this.headerlog = LogManager.getLogger("org.apache.hc.core5.http.headers");
+        this.wire = new Wire(LogManager.getLogger("org.apache.hc.core5.http.wire"), this.id);
     }
 
     @Override