hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1393540 - /httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/LocalTestServer.java
Date Wed, 03 Oct 2012 15:28:09 GMT
Author: olegk
Date: Wed Oct  3 15:28:08 2012
New Revision: 1393540

URL: http://svn.apache.org/viewvc?rev=1393540&view=rev
Log:
HTTPCLIENT-1239: Support for overridable DefaultHttpServerConnection in LocalTestServer
Contributed by Okke Harsta <oharsta at apache.org>

Modified:
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/LocalTestServer.java

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/LocalTestServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/LocalTestServer.java?rev=1393540&r1=1393539&r2=1393540&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/LocalTestServer.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/LocalTestServer.java
Wed Oct  3 15:28:08 2012
@@ -320,6 +320,19 @@ public class LocalTestServer {
     }
 
     /**
+     * Creates an instance of {@link DefaultHttpServerConnection} to be used
+     * in the Worker thread.
+     * <p>
+     * This method can be overridden in a super class in order to provide
+     * a different implementation of the {@link DefaultHttpServerConnection}.
+     *
+     * @return DefaultHttpServerConnection.
+     */
+    protected DefaultHttpServerConnection createHttpServerConnection() {
+      return new DefaultHttpServerConnection();
+    }
+
+    /**
      * The request listener.
      * Accepts incoming connections and launches a service thread.
      */
@@ -337,7 +350,7 @@ public class LocalTestServer {
                 while (!interrupted()) {
                     Socket socket = servicedSocket.accept();
                     acceptedConnections.incrementAndGet();
-                    DefaultHttpServerConnection conn = new DefaultHttpServerConnection();
+                    DefaultHttpServerConnection conn = createHttpServerConnection();
                     conn.bind(socket, httpservice.getParams());
                     // Start worker thread
                     Worker worker = new Worker(conn);



Mime
View raw message