hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1599009 - in /httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http: impl/nio/reactor/ nio/integration/ nio/testserver/
Date Sun, 01 Jun 2014 17:19:50 GMT
Author: olegk
Date: Sun Jun  1 17:19:49 2014
New Revision: 1599009

URL: http://svn.apache.org/r1599009
Log:
Improved parameterized test cases

Added:
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ClientConnectionFactory.java   (contents, props changed)
      - copied, changed from r1598895, httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingSSLClientConnectionFactory.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ServerConnectionFactory.java   (contents, props changed)
      - copied, changed from r1598895, httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingSSLServerConnectionFactory.java
Removed:
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultIOReactorsSSL.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpsAsyncHandlers.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpsAsyncHandlersPipelining.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingClientConnectionFactory.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingSSLClientConnectionFactory.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingSSLServerConnectionFactory.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingServerConnectionFactory.java
Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultIOReactors.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestCustomSSL.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlerCancellable.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlers.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlersPipelining.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncPrematureTermination.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpsAsyncTimeout.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestServerSidePipelining.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestTruncatedChunks.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/HttpCoreNIOTestBase.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultIOReactors.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultIOReactors.java?rev=1599009&r1=1599008&r2=1599009&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultIOReactors.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultIOReactors.java Sun Jun  1 17:19:49 2014
@@ -29,6 +29,8 @@ package org.apache.http.impl.nio.reactor
 
 import java.io.IOException;
 import java.net.InetSocketAddress;
+import java.util.Arrays;
+import java.util.Collection;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Queue;
@@ -42,12 +44,9 @@ import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.OoopsieRuntimeException;
-import org.apache.http.impl.nio.DefaultNHttpClientConnection;
-import org.apache.http.impl.nio.DefaultNHttpServerConnection;
 import org.apache.http.impl.nio.pool.BasicNIOPoolEntry;
 import org.apache.http.message.BasicHttpRequest;
 import org.apache.http.nio.NHttpClientConnection;
-import org.apache.http.nio.NHttpConnectionFactory;
 import org.apache.http.nio.NHttpServerConnection;
 import org.apache.http.nio.protocol.BasicAsyncRequestHandler;
 import org.apache.http.nio.protocol.HttpAsyncRequestExecutor;
@@ -59,20 +58,33 @@ import org.apache.http.nio.reactor.IORea
 import org.apache.http.nio.reactor.ListenerEndpoint;
 import org.apache.http.nio.testserver.HttpCoreNIOTestBase;
 import org.apache.http.nio.testserver.HttpServerNio;
-import org.apache.http.nio.testserver.LoggingClientConnectionFactory;
-import org.apache.http.nio.testserver.LoggingServerConnectionFactory;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpRequestHandler;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
 
 /**
  * Tests for basic I/O functionality.
  */
+@RunWith(Parameterized.class)
 public class TestDefaultIOReactors extends HttpCoreNIOTestBase {
 
+    @Parameterized.Parameters(name = "{0}")
+    public static Collection<Object[]> protocols() {
+        return Arrays.asList(new Object[][]{
+                {ProtocolScheme.http},
+                {ProtocolScheme.https},
+        });
+    }
+
+    public TestDefaultIOReactors(final ProtocolScheme scheme) {
+        super(scheme);
+    }
+
     @Before
     public void setUp() throws Exception {
         initServer();
@@ -85,16 +97,6 @@ public class TestDefaultIOReactors exten
         shutDownServer();
     }
 
-    @Override
-    protected NHttpConnectionFactory<DefaultNHttpServerConnection> createServerConnectionFactory() throws Exception {
-        return new LoggingServerConnectionFactory();
-    }
-
-    @Override
-    protected NHttpConnectionFactory<DefaultNHttpClientConnection> createClientConnectionFactory() throws Exception {
-        return new LoggingClientConnectionFactory();
-    }
-
     @Test
     public void testGracefulShutdown() throws Exception {
         final int connNo = 10;
@@ -146,7 +148,7 @@ public class TestDefaultIOReactors exten
         final ListenerEndpoint endpoint = this.server.getListenerEndpoint();
         endpoint.waitFor();
         final InetSocketAddress address = (InetSocketAddress) endpoint.getAddress();
-        final HttpHost target = new HttpHost("localhost", address.getPort());
+        final HttpHost target = new HttpHost("localhost", address.getPort(), getScheme().name());
 
         Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
 
@@ -210,7 +212,7 @@ public class TestDefaultIOReactors exten
         final ListenerEndpoint endpoint = this.server.getListenerEndpoint();
         endpoint.waitFor();
         final InetSocketAddress address = (InetSocketAddress) endpoint.getAddress();
-        final HttpHost target = new HttpHost("localhost", address.getPort());
+        final HttpHost target = new HttpHost("localhost", address.getPort(), getScheme().name());
 
         Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
 
@@ -290,7 +292,7 @@ public class TestDefaultIOReactors exten
         final ListenerEndpoint endpoint = this.server.getListenerEndpoint();
         endpoint.waitFor();
         final InetSocketAddress address = (InetSocketAddress) endpoint.getAddress();
-        final HttpHost target = new HttpHost("localhost", address.getPort());
+        final HttpHost target = new HttpHost("localhost", address.getPort(), getScheme().name());
 
         Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
 
@@ -370,7 +372,7 @@ public class TestDefaultIOReactors exten
         final ListenerEndpoint endpoint = this.server.getListenerEndpoint();
         endpoint.waitFor();
         final InetSocketAddress address = (InetSocketAddress) endpoint.getAddress();
-        final HttpHost target = new HttpHost("localhost", address.getPort());
+        final HttpHost target = new HttpHost("localhost", address.getPort(), getScheme().name());
 
         Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
 

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestCustomSSL.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestCustomSSL.java?rev=1599009&r1=1599008&r2=1599009&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestCustomSSL.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestCustomSSL.java Sun Jun  1 17:19:49 2014
@@ -40,10 +40,10 @@ import org.apache.http.nio.reactor.IORea
 import org.apache.http.nio.reactor.IOSession;
 import org.apache.http.nio.reactor.ListenerEndpoint;
 import org.apache.http.nio.reactor.ssl.SSLSetupHandler;
+import org.apache.http.nio.testserver.ClientConnectionFactory;
 import org.apache.http.nio.testserver.HttpClientNio;
 import org.apache.http.nio.testserver.HttpServerNio;
-import org.apache.http.nio.testserver.LoggingSSLClientConnectionFactory;
-import org.apache.http.nio.testserver.LoggingSSLServerConnectionFactory;
+import org.apache.http.nio.testserver.ServerConnectionFactory;
 import org.apache.http.nio.testserver.SSLTestContexts;
 import org.apache.http.nio.testserver.SimpleIOReactorExceptionHandler;
 import org.apache.http.protocol.HttpContext;
@@ -117,13 +117,13 @@ public class TestCustomSSL {
         };
 
         this.server = new HttpServerNio(
-                new LoggingSSLServerConnectionFactory(
+                new ServerConnectionFactory(
                         SSLTestContexts.createServerSSLContext(), sslSetupHandler));
         this.server.setExceptionHandler(new SimpleIOReactorExceptionHandler());
         this.server.setTimeout(5000);
         this.client = new HttpClientNio(
                 new BasicNIOConnFactory(
-                        new LoggingSSLClientConnectionFactory(
+                        new ClientConnectionFactory(
                                 SSLTestContexts.createClientSSLContext()), null));
         this.client.setExceptionHandler(new SimpleIOReactorExceptionHandler());
         this.client.setTimeout(5000);

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlerCancellable.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlerCancellable.java?rev=1599009&r1=1599008&r2=1599009&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlerCancellable.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlerCancellable.java Sun Jun  1 17:19:49 2014
@@ -43,12 +43,9 @@ import org.apache.http.HttpVersion;
 import org.apache.http.concurrent.Cancellable;
 import org.apache.http.entity.BasicHttpEntity;
 import org.apache.http.entity.ContentType;
-import org.apache.http.impl.nio.DefaultNHttpClientConnection;
-import org.apache.http.impl.nio.DefaultNHttpServerConnection;
 import org.apache.http.message.BasicHttpResponse;
 import org.apache.http.nio.ContentEncoder;
 import org.apache.http.nio.IOControl;
-import org.apache.http.nio.NHttpConnectionFactory;
 import org.apache.http.nio.protocol.BasicAsyncRequestConsumer;
 import org.apache.http.nio.protocol.HttpAsyncExchange;
 import org.apache.http.nio.protocol.HttpAsyncRequestConsumer;
@@ -58,8 +55,6 @@ import org.apache.http.nio.protocol.UriH
 import org.apache.http.nio.reactor.IOReactorStatus;
 import org.apache.http.nio.reactor.ListenerEndpoint;
 import org.apache.http.nio.testserver.HttpCoreNIOTestBase;
-import org.apache.http.nio.testserver.LoggingClientConnectionFactory;
-import org.apache.http.nio.testserver.LoggingServerConnectionFactory;
 import org.apache.http.protocol.HttpContext;
 import org.junit.After;
 import org.junit.Assert;
@@ -78,16 +73,6 @@ public class TestHttpAsyncHandlerCancell
         shutDownServer();
     }
 
-    @Override
-    protected NHttpConnectionFactory<DefaultNHttpServerConnection> createServerConnectionFactory() throws Exception {
-        return new LoggingServerConnectionFactory();
-    }
-
-    @Override
-    protected NHttpConnectionFactory<DefaultNHttpClientConnection> createClientConnectionFactory() throws Exception {
-        return new LoggingClientConnectionFactory();
-    }
-
     @Test
     public void testResponsePrematureTermination() throws Exception {
 

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlers.java?rev=1599009&r1=1599008&r2=1599009&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlers.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlers.java Sun Jun  1 17:19:49 2014
@@ -29,6 +29,8 @@ package org.apache.http.nio.integration;
 
 import java.io.IOException;
 import java.net.InetSocketAddress;
+import java.util.Arrays;
+import java.util.Collection;
 import java.util.Queue;
 import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.concurrent.Future;
@@ -42,12 +44,9 @@ import org.apache.http.HttpStatus;
 import org.apache.http.HttpVersion;
 import org.apache.http.ProtocolVersion;
 import org.apache.http.entity.ContentType;
-import org.apache.http.impl.nio.DefaultNHttpClientConnection;
-import org.apache.http.impl.nio.DefaultNHttpServerConnection;
 import org.apache.http.message.BasicHttpEntityEnclosingRequest;
 import org.apache.http.message.BasicHttpRequest;
 import org.apache.http.message.BasicHttpResponse;
-import org.apache.http.nio.NHttpConnectionFactory;
 import org.apache.http.nio.entity.NStringEntity;
 import org.apache.http.nio.protocol.BasicAsyncRequestConsumer;
 import org.apache.http.nio.protocol.BasicAsyncRequestHandler;
@@ -61,8 +60,6 @@ import org.apache.http.nio.protocol.UriH
 import org.apache.http.nio.reactor.IOReactorStatus;
 import org.apache.http.nio.reactor.ListenerEndpoint;
 import org.apache.http.nio.testserver.HttpCoreNIOTestBase;
-import org.apache.http.nio.testserver.LoggingClientConnectionFactory;
-import org.apache.http.nio.testserver.LoggingServerConnectionFactory;
 import org.apache.http.protocol.BasicHttpContext;
 import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpContext;
@@ -78,12 +75,27 @@ import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
 
 /**
  * HttpCore NIO integration tests for async handlers.
  */
+@RunWith(Parameterized.class)
 public class TestHttpAsyncHandlers extends HttpCoreNIOTestBase {
 
+    @Parameterized.Parameters(name = "{0}")
+    public static Collection<Object[]> protocols() {
+        return Arrays.asList(new Object[][]{
+                { ProtocolScheme.http },
+                { ProtocolScheme.https },
+        });
+    }
+
+    public TestHttpAsyncHandlers(final ProtocolScheme scheme) {
+        super(scheme);
+    }
+
     @Before
     public void setUp() throws Exception {
         initServer();
@@ -96,17 +108,7 @@ public class TestHttpAsyncHandlers exten
         shutDownServer();
     }
 
-    @Override
-    protected NHttpConnectionFactory<DefaultNHttpServerConnection> createServerConnectionFactory() throws Exception {
-        return new LoggingServerConnectionFactory();
-    }
-
-    @Override
-    protected NHttpConnectionFactory<DefaultNHttpClientConnection> createClientConnectionFactory() throws Exception {
-        return new LoggingClientConnectionFactory();
-    }
-
-    private InetSocketAddress start(
+    private HttpHost start(
             final HttpProcessor clientProtocolProcessor,
             final HttpProcessor serverProtocolProcessor,
             final HttpAsyncRequestHandlerMapper requestHandlerResolver,
@@ -118,10 +120,11 @@ public class TestHttpAsyncHandlers exten
         endpoint.waitFor();
 
         Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
-        return (InetSocketAddress) endpoint.getAddress();
+        final InetSocketAddress address = (InetSocketAddress) endpoint.getAddress();
+        return new HttpHost("localhost", address.getPort(), getScheme().name());
     }
 
-    private InetSocketAddress start(
+    private HttpHost start(
             final HttpAsyncRequestHandlerMapper requestHandlerResolver,
             final HttpAsyncExpectationVerifier expectationVerifier) throws Exception {
         return start(null, null, requestHandlerResolver, expectationVerifier);
@@ -143,7 +146,7 @@ public class TestHttpAsyncHandlers exten
     public void testHttpGets() throws Exception {
         final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
         registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final InetSocketAddress address = start(registry, null);
+        final HttpHost target = start(registry, null);
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -151,7 +154,6 @@ public class TestHttpAsyncHandlers exten
         final String pattern = RndTestPatternGenerator.generateText();
         final int count = RndTestPatternGenerator.generateCount(1000);
 
-        final HttpHost target = new HttpHost("localhost", address.getPort());
         final String expectedPattern = createExpectedString(pattern, count);
 
         final Queue<Future<HttpResponse>> queue = new ConcurrentLinkedQueue<Future<HttpResponse>>();
@@ -173,7 +175,7 @@ public class TestHttpAsyncHandlers exten
     public void testHttpHeads() throws Exception {
         final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
         registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final InetSocketAddress address = start(registry, null);
+        final HttpHost target = start(registry, null);
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -181,8 +183,6 @@ public class TestHttpAsyncHandlers exten
         final String pattern = RndTestPatternGenerator.generateText();
         final int count = RndTestPatternGenerator.generateCount(1000);
 
-        final HttpHost target = new HttpHost("localhost", address.getPort());
-
         final Queue<Future<HttpResponse>> queue = new ConcurrentLinkedQueue<Future<HttpResponse>>();
         for (int i = 0; i < 30; i++) {
             final BasicHttpRequest request = new BasicHttpRequest("HEAD", createRequestUri(pattern, count));
@@ -202,7 +202,7 @@ public class TestHttpAsyncHandlers exten
     public void testHttpPostsWithContentLength() throws Exception {
         final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
         registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final InetSocketAddress address = start(registry, null);
+        final HttpHost target = start(registry, null);
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -210,7 +210,6 @@ public class TestHttpAsyncHandlers exten
         final String pattern = RndTestPatternGenerator.generateText();
         final int count = RndTestPatternGenerator.generateCount(1000);
 
-        final HttpHost target = new HttpHost("localhost", address.getPort());
         final String expectedPattern = createExpectedString(pattern, count);
 
         final Queue<Future<HttpResponse>> queue = new ConcurrentLinkedQueue<Future<HttpResponse>>();
@@ -235,7 +234,7 @@ public class TestHttpAsyncHandlers exten
     public void testHttpPostsChunked() throws Exception {
         final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
         registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final InetSocketAddress address = start(registry, null);
+        final HttpHost target = start(registry, null);
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -243,7 +242,6 @@ public class TestHttpAsyncHandlers exten
         final String pattern = RndTestPatternGenerator.generateText();
         final int count = RndTestPatternGenerator.generateCount(1000);
 
-        final HttpHost target = new HttpHost("localhost", address.getPort());
         final String expectedPattern = createExpectedString(pattern, count);
 
         final Queue<Future<HttpResponse>> queue = new ConcurrentLinkedQueue<Future<HttpResponse>>();
@@ -269,7 +267,7 @@ public class TestHttpAsyncHandlers exten
     public void testHttpPostsHTTP10() throws Exception {
         final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
         registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final InetSocketAddress address = start(registry, null);
+        final HttpHost target = start(registry, null);
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -277,7 +275,6 @@ public class TestHttpAsyncHandlers exten
         final String pattern = RndTestPatternGenerator.generateText();
         final int count = RndTestPatternGenerator.generateCount(1000);
 
-        final HttpHost target = new HttpHost("localhost", address.getPort());
         final String expectedPattern = createExpectedString(pattern, count);
 
         final Queue<Future<HttpResponse>> queue = new ConcurrentLinkedQueue<Future<HttpResponse>>();
@@ -302,7 +299,7 @@ public class TestHttpAsyncHandlers exten
     public void testHttpPostsNoEntity() throws Exception {
         final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
         registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final InetSocketAddress address = start(registry, null);
+        final HttpHost target = start(registry, null);
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -310,8 +307,6 @@ public class TestHttpAsyncHandlers exten
         final String pattern = RndTestPatternGenerator.generateText();
         final int count = RndTestPatternGenerator.generateCount(1000);
 
-        final HttpHost target = new HttpHost("localhost", address.getPort());
-
         final Queue<Future<HttpResponse>> queue = new ConcurrentLinkedQueue<Future<HttpResponse>>();
         for (int i = 0; i < 30; i++) {
             final BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest(
@@ -334,13 +329,13 @@ public class TestHttpAsyncHandlers exten
         final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
         registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
 
-        final HttpProcessor clientHttpProc = new ImmutableHttpProcessor(new HttpRequestInterceptor[] {
+        final HttpProcessor clientHttpProc = new ImmutableHttpProcessor(
                 new RequestTargetHost(),
                 new RequestConnControl(),
                 new RequestUserAgent(),
-                new RequestExpectContinue(true)});
+                new RequestExpectContinue(true));
 
-        final InetSocketAddress address = start(clientHttpProc, null, registry, null);
+        final HttpHost target = start(clientHttpProc, null, registry, null);
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -348,8 +343,6 @@ public class TestHttpAsyncHandlers exten
         final String pattern = RndTestPatternGenerator.generateText();
         final int count = RndTestPatternGenerator.generateCount(1000);
 
-        final HttpHost target = new HttpHost("localhost", address.getPort());
-
         final BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest(
                 "POST", createRequestUri(pattern, count));
         request.setEntity(null);
@@ -366,7 +359,7 @@ public class TestHttpAsyncHandlers exten
         final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
         registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
 
-        final HttpProcessor clientHttpProc = new ImmutableHttpProcessor(new HttpRequestInterceptor[] {
+        final HttpProcessor clientHttpProc = new ImmutableHttpProcessor(
                 new HttpRequestInterceptor() {
 
                     @Override
@@ -380,9 +373,9 @@ public class TestHttpAsyncHandlers exten
                 new RequestTargetHost(),
                 new RequestConnControl(),
                 new RequestUserAgent(),
-                new RequestExpectContinue(true)});
+                new RequestExpectContinue(true));
 
-        final InetSocketAddress address = start(clientHttpProc, null, registry, null);
+        final HttpHost target = start(clientHttpProc, null, registry, null);
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -390,8 +383,6 @@ public class TestHttpAsyncHandlers exten
         final String pattern = RndTestPatternGenerator.generateText();
         final int count = RndTestPatternGenerator.generateCount(1000);
 
-        final HttpHost target = new HttpHost("localhost", address.getPort());
-
         final BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest(
                 "POST", createRequestUri(pattern, count));
         request.setEntity(null);
@@ -407,7 +398,7 @@ public class TestHttpAsyncHandlers exten
     public void testHttpPostsWithExpectContinue() throws Exception {
         final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
         registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final InetSocketAddress address = start(registry, null);
+        final HttpHost target = start(registry, null);
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -415,7 +406,6 @@ public class TestHttpAsyncHandlers exten
         final String pattern = RndTestPatternGenerator.generateText();
         final int count = RndTestPatternGenerator.generateCount(1000);
 
-        final HttpHost target = new HttpHost("localhost", address.getPort());
         final String expectedPattern = createExpectedString(pattern, count);
 
         final Queue<Future<HttpResponse>> queue = new ConcurrentLinkedQueue<Future<HttpResponse>>();
@@ -466,7 +456,7 @@ public class TestHttpAsyncHandlers exten
 
         final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
         registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final InetSocketAddress address = start(registry, expectationVerifier);
+        final HttpHost target = start(registry, expectationVerifier);
 
         final BasicHttpEntityEnclosingRequest request1 = new BasicHttpEntityEnclosingRequest(
                 "POST", createRequestUri("AAAAA", 10));
@@ -480,8 +470,6 @@ public class TestHttpAsyncHandlers exten
 
         final HttpRequest[] requests = new HttpRequest[] { request1, request2, request3 };
 
-        final HttpHost target = new HttpHost("localhost", address.getPort());
-
         final Queue<Future<HttpResponse>> queue = new ConcurrentLinkedQueue<Future<HttpResponse>>();
         for (final HttpRequest request : requests) {
             final HttpContext context = new BasicHttpContext();
@@ -551,7 +539,7 @@ public class TestHttpAsyncHandlers exten
 
         final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
         registry.register("*", new DelayedRequestHandler());
-        final InetSocketAddress address = start(registry, null);
+        final HttpHost target = start(registry, null);
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -559,8 +547,6 @@ public class TestHttpAsyncHandlers exten
         final String pattern = RndTestPatternGenerator.generateText();
         final int count = RndTestPatternGenerator.generateCount(1000);
 
-        final HttpHost target = new HttpHost("localhost", address.getPort());
-
         final Queue<Future<HttpResponse>> queue = new ConcurrentLinkedQueue<Future<HttpResponse>>();
         for (int i = 0; i < 30; i++) {
             final BasicHttpRequest request = new BasicHttpRequest("HEAD", createRequestUri(pattern, count));
@@ -612,7 +598,7 @@ public class TestHttpAsyncHandlers exten
 
         final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
         registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final InetSocketAddress address = start(registry, expectationVerifier);
+        final HttpHost target = start(registry, expectationVerifier);
 
         final BasicHttpEntityEnclosingRequest request1 = new BasicHttpEntityEnclosingRequest(
                 "POST", createRequestUri("AAAAA", 10));
@@ -626,8 +612,6 @@ public class TestHttpAsyncHandlers exten
 
         final HttpRequest[] requests = new HttpRequest[] { request1, request2, request3 };
 
-        final HttpHost target = new HttpHost("localhost", address.getPort());
-
         final Queue<Future<HttpResponse>> queue = new ConcurrentLinkedQueue<Future<HttpResponse>>();
         for (final HttpRequest request : requests) {
             final HttpContext context = new BasicHttpContext();
@@ -676,7 +660,7 @@ public class TestHttpAsyncHandlers exten
 
         final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
         registry.register("*", new FailingRequestHandler());
-        final InetSocketAddress address = start(registry, null);
+        final HttpHost target = start(registry, null);
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -684,8 +668,6 @@ public class TestHttpAsyncHandlers exten
         final String pattern = RndTestPatternGenerator.generateText();
         final int count = RndTestPatternGenerator.generateCount(1000);
 
-        final HttpHost target = new HttpHost("localhost", address.getPort());
-
         final Queue<Future<HttpResponse>> queue = new ConcurrentLinkedQueue<Future<HttpResponse>>();
         for (int i = 0; i < 1; i++) {
             final BasicHttpRequest request = new BasicHttpRequest("GET", createRequestUri(pattern, count));
@@ -704,7 +686,7 @@ public class TestHttpAsyncHandlers exten
     @Test
     public void testNoServiceHandler() throws Exception {
         final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        final InetSocketAddress address = start(registry, null);
+        final HttpHost target = start(registry, null);
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -712,8 +694,6 @@ public class TestHttpAsyncHandlers exten
         final String pattern = RndTestPatternGenerator.generateText();
         final int count = RndTestPatternGenerator.generateCount(1000);
 
-        final HttpHost target = new HttpHost("localhost", address.getPort());
-
         final Queue<Future<HttpResponse>> queue = new ConcurrentLinkedQueue<Future<HttpResponse>>();
         for (int i = 0; i < 30; i++) {
             final BasicHttpRequest request = new BasicHttpRequest("GET", createRequestUri(pattern, count));
@@ -743,13 +723,11 @@ public class TestHttpAsyncHandlers exten
             }
 
         }));
-        final InetSocketAddress address = start(registry, null);
+        final HttpHost target = start(registry, null);
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
 
-        final HttpHost target = new HttpHost("localhost", address.getPort());
-
         final Queue<Future<HttpResponse>> queue = new ConcurrentLinkedQueue<Future<HttpResponse>>();
         for (int i = 0; i < 30; i++) {
             final BasicHttpRequest request = new BasicHttpRequest("GET", "/");

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlersPipelining.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlersPipelining.java?rev=1599009&r1=1599008&r2=1599009&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlersPipelining.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncHandlersPipelining.java Sun Jun  1 17:19:49 2014
@@ -29,6 +29,8 @@ package org.apache.http.nio.integration;
 
 import java.io.IOException;
 import java.net.InetSocketAddress;
+import java.util.Arrays;
+import java.util.Collection;
 import java.util.List;
 import java.util.Queue;
 import java.util.concurrent.ConcurrentLinkedQueue;
@@ -42,12 +44,9 @@ import org.apache.http.HttpResponse;
 import org.apache.http.HttpStatus;
 import org.apache.http.HttpVersion;
 import org.apache.http.entity.ContentType;
-import org.apache.http.impl.nio.DefaultNHttpClientConnection;
-import org.apache.http.impl.nio.DefaultNHttpServerConnection;
 import org.apache.http.message.BasicHttpEntityEnclosingRequest;
 import org.apache.http.message.BasicHttpRequest;
 import org.apache.http.message.BasicHttpResponse;
-import org.apache.http.nio.NHttpConnectionFactory;
 import org.apache.http.nio.entity.NStringEntity;
 import org.apache.http.nio.protocol.BasicAsyncRequestConsumer;
 import org.apache.http.nio.protocol.BasicAsyncRequestHandler;
@@ -61,8 +60,6 @@ import org.apache.http.nio.protocol.UriH
 import org.apache.http.nio.reactor.IOReactorStatus;
 import org.apache.http.nio.reactor.ListenerEndpoint;
 import org.apache.http.nio.testserver.HttpCoreNIOTestBase;
-import org.apache.http.nio.testserver.LoggingClientConnectionFactory;
-import org.apache.http.nio.testserver.LoggingServerConnectionFactory;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpProcessor;
 import org.apache.http.protocol.ImmutableHttpProcessor;
@@ -75,12 +72,27 @@ import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
 
 /**
  * HttpCore NIO integration tests for pipelined request processing.
  */
+@RunWith(Parameterized.class)
 public class TestHttpAsyncHandlersPipelining extends HttpCoreNIOTestBase {
 
+    @Parameterized.Parameters(name = "{0}")
+    public static Collection<Object[]> protocols() {
+        return Arrays.asList(new Object[][]{
+                {ProtocolScheme.http},
+                {ProtocolScheme.https},
+        });
+    }
+
+    public TestHttpAsyncHandlersPipelining(final ProtocolScheme scheme) {
+        super(scheme);
+    }
+
     public static final HttpProcessor DEFAULT_HTTP_PROC = new ImmutableHttpProcessor(
             new RequestContent(),
             new RequestTargetHost(),
@@ -99,17 +111,7 @@ public class TestHttpAsyncHandlersPipeli
         shutDownServer();
     }
 
-    @Override
-    protected NHttpConnectionFactory<DefaultNHttpServerConnection> createServerConnectionFactory() throws Exception {
-        return new LoggingServerConnectionFactory();
-    }
-
-    @Override
-    protected NHttpConnectionFactory<DefaultNHttpClientConnection> createClientConnectionFactory() throws Exception {
-        return new LoggingClientConnectionFactory();
-    }
-
-    private InetSocketAddress start(
+    private HttpHost start(
             final HttpProcessor clientProtocolProcessor,
             final HttpProcessor serverProtocolProcessor,
             final HttpAsyncRequestHandlerMapper requestHandlerResolver,
@@ -121,10 +123,11 @@ public class TestHttpAsyncHandlersPipeli
         endpoint.waitFor();
 
         Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
-        return (InetSocketAddress) endpoint.getAddress();
+        final InetSocketAddress address = (InetSocketAddress) endpoint.getAddress();
+        return new HttpHost("localhost", address.getPort(), getScheme().name());
     }
 
-    private InetSocketAddress start(
+    private HttpHost start(
             final HttpAsyncRequestHandlerMapper requestHandlerResolver,
             final HttpAsyncExpectationVerifier expectationVerifier) throws Exception {
         return start(DEFAULT_HTTP_PROC, null, requestHandlerResolver, expectationVerifier);
@@ -146,7 +149,7 @@ public class TestHttpAsyncHandlersPipeli
     public void testHttpGets() throws Exception {
         final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
         registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final InetSocketAddress address = start(registry, null);
+        final HttpHost target = start(registry, null);
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -154,7 +157,6 @@ public class TestHttpAsyncHandlersPipeli
         final String pattern = RndTestPatternGenerator.generateText();
         final int count = RndTestPatternGenerator.generateCount(1000);
 
-        final HttpHost target = new HttpHost("localhost", address.getPort());
         final String expectedPattern = createExpectedString(pattern, count);
 
         final Queue<Future<List<HttpResponse>>> queue = new ConcurrentLinkedQueue<Future<List<HttpResponse>>>();
@@ -183,7 +185,7 @@ public class TestHttpAsyncHandlersPipeli
     public void testHttpHeads() throws Exception {
         final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
         registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final InetSocketAddress address = start(registry, null);
+        final HttpHost target = start(registry, null);
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -191,8 +193,6 @@ public class TestHttpAsyncHandlersPipeli
         final String pattern = RndTestPatternGenerator.generateText();
         final int count = RndTestPatternGenerator.generateCount(1000);
 
-        final HttpHost target = new HttpHost("localhost", address.getPort());
-
         final Queue<Future<List<HttpResponse>>> queue = new ConcurrentLinkedQueue<Future<List<HttpResponse>>>();
         for (int i = 0; i < 10; i++) {
             final String requestUri = createRequestUri(pattern, count);
@@ -218,7 +218,7 @@ public class TestHttpAsyncHandlersPipeli
     public void testHttpPosts() throws Exception {
         final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
         registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final InetSocketAddress address = start(registry, null);
+        final HttpHost target = start(registry, null);
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -226,7 +226,6 @@ public class TestHttpAsyncHandlersPipeli
         final String pattern = RndTestPatternGenerator.generateText();
         final int count = RndTestPatternGenerator.generateCount(1000);
 
-        final HttpHost target = new HttpHost("localhost", address.getPort());
         final String expectedPattern = createExpectedString(pattern, count);
 
         final Queue<Future<List<HttpResponse>>> queue = new ConcurrentLinkedQueue<Future<List<HttpResponse>>>();
@@ -306,7 +305,7 @@ public class TestHttpAsyncHandlersPipeli
 
         final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
         registry.register("*", new DelayedRequestHandler());
-        final InetSocketAddress address = start(registry, null);
+        final HttpHost target = start(registry, null);
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -316,7 +315,6 @@ public class TestHttpAsyncHandlersPipeli
         final String pattern3 = RndTestPatternGenerator.generateText();
         final int count = RndTestPatternGenerator.generateCount(1000);
 
-        final HttpHost target = new HttpHost("localhost", address.getPort());
         final String expectedPattern1 = createExpectedString(pattern1, count);
         final String expectedPattern2 = createExpectedString(pattern2, count);
         final String expectedPattern3 = createExpectedString(pattern3, count);

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncPrematureTermination.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncPrematureTermination.java?rev=1599009&r1=1599008&r2=1599009&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncPrematureTermination.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpAsyncPrematureTermination.java Sun Jun  1 17:19:49 2014
@@ -42,12 +42,9 @@ import org.apache.http.HttpResponse;
 import org.apache.http.concurrent.FutureCallback;
 import org.apache.http.entity.ContentType;
 import org.apache.http.entity.InputStreamEntity;
-import org.apache.http.impl.nio.DefaultNHttpClientConnection;
-import org.apache.http.impl.nio.DefaultNHttpServerConnection;
 import org.apache.http.message.BasicHttpRequest;
 import org.apache.http.nio.ContentEncoder;
 import org.apache.http.nio.IOControl;
-import org.apache.http.nio.NHttpConnectionFactory;
 import org.apache.http.nio.entity.NStringEntity;
 import org.apache.http.nio.protocol.BasicAsyncRequestConsumer;
 import org.apache.http.nio.protocol.BasicAsyncResponseProducer;
@@ -60,8 +57,6 @@ import org.apache.http.nio.protocol.UriH
 import org.apache.http.nio.reactor.IOReactorStatus;
 import org.apache.http.nio.reactor.ListenerEndpoint;
 import org.apache.http.nio.testserver.HttpCoreNIOTestBase;
-import org.apache.http.nio.testserver.LoggingClientConnectionFactory;
-import org.apache.http.nio.testserver.LoggingServerConnectionFactory;
 import org.apache.http.protocol.BasicHttpContext;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpCoreContext;
@@ -84,16 +79,6 @@ public class TestHttpAsyncPrematureTermi
         shutDownServer();
     }
 
-    @Override
-    protected NHttpConnectionFactory<DefaultNHttpServerConnection> createServerConnectionFactory() throws Exception {
-        return new LoggingServerConnectionFactory();
-    }
-
-    @Override
-    protected NHttpConnectionFactory<DefaultNHttpClientConnection> createClientConnectionFactory() throws Exception {
-        return new LoggingClientConnectionFactory();
-    }
-
     private InetSocketAddress start(
             final HttpAsyncRequestHandlerMapper requestHandlerResolver,
             final HttpAsyncExpectationVerifier expectationVerifier) throws Exception {

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpsAsyncTimeout.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpsAsyncTimeout.java?rev=1599009&r1=1599008&r2=1599009&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpsAsyncTimeout.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestHttpsAsyncTimeout.java Sun Jun  1 17:19:49 2014
@@ -37,21 +37,11 @@ import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.concurrent.FutureCallback;
-import org.apache.http.impl.nio.DefaultNHttpClientConnection;
-import org.apache.http.impl.nio.DefaultNHttpServerConnection;
-import org.apache.http.impl.nio.pool.BasicNIOConnFactory;
 import org.apache.http.message.BasicHttpRequest;
-import org.apache.http.nio.NHttpClientConnection;
-import org.apache.http.nio.NHttpConnectionFactory;
-import org.apache.http.nio.pool.NIOConnFactory;
 import org.apache.http.nio.protocol.BasicAsyncRequestProducer;
 import org.apache.http.nio.protocol.BasicAsyncResponseConsumer;
 import org.apache.http.nio.protocol.HttpAsyncRequestExecutor;
 import org.apache.http.nio.testserver.HttpCoreNIOTestBase;
-import org.apache.http.nio.testserver.LoggingClientConnectionFactory;
-import org.apache.http.nio.testserver.LoggingSSLClientConnectionFactory;
-import org.apache.http.nio.testserver.LoggingServerConnectionFactory;
-import org.apache.http.nio.testserver.SSLTestContexts;
 import org.apache.http.protocol.BasicHttpContext;
 import org.apache.http.protocol.HttpContext;
 import org.junit.After;
@@ -74,25 +64,6 @@ public class TestHttpsAsyncTimeout exten
         shutDownClient();
     }
 
-    @Override
-    protected NHttpConnectionFactory<DefaultNHttpServerConnection> createServerConnectionFactory()
-        throws Exception {
-        return new LoggingServerConnectionFactory();
-    }
-
-    @Override
-    protected NHttpConnectionFactory<DefaultNHttpClientConnection> createClientConnectionFactory()
-        throws Exception {
-        return new LoggingClientConnectionFactory();
-    }
-
-    @Override
-    protected NIOConnFactory<HttpHost, NHttpClientConnection> createPoolConnectionFactory()
-        throws Exception {
-        return new BasicNIOConnFactory(createClientConnectionFactory(),
-            new LoggingSSLClientConnectionFactory(SSLTestContexts.createClientSSLContext()));
-    }
-
     private InetSocketAddress start() throws Exception {
 
         final HttpAsyncRequestExecutor clientHandler = new HttpAsyncRequestExecutor();

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestServerSidePipelining.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestServerSidePipelining.java?rev=1599009&r1=1599008&r2=1599009&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestServerSidePipelining.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestServerSidePipelining.java Sun Jun  1 17:19:49 2014
@@ -43,9 +43,6 @@ import org.apache.http.HttpException;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.entity.ContentType;
-import org.apache.http.impl.nio.DefaultNHttpClientConnection;
-import org.apache.http.impl.nio.DefaultNHttpServerConnection;
-import org.apache.http.nio.NHttpConnectionFactory;
 import org.apache.http.nio.entity.NByteArrayEntity;
 import org.apache.http.nio.entity.NStringEntity;
 import org.apache.http.nio.protocol.BasicAsyncRequestHandler;
@@ -54,8 +51,6 @@ import org.apache.http.nio.protocol.UriH
 import org.apache.http.nio.reactor.IOReactorStatus;
 import org.apache.http.nio.reactor.ListenerEndpoint;
 import org.apache.http.nio.testserver.HttpCoreNIOTestBase;
-import org.apache.http.nio.testserver.LoggingClientConnectionFactory;
-import org.apache.http.nio.testserver.LoggingServerConnectionFactory;
 import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpProcessor;
@@ -139,16 +134,6 @@ public class TestServerSidePipelining ex
         shutDownServer();
     }
 
-    @Override
-    protected NHttpConnectionFactory<DefaultNHttpServerConnection> createServerConnectionFactory() throws Exception {
-        return new LoggingServerConnectionFactory();
-    }
-
-    @Override
-    protected NHttpConnectionFactory<DefaultNHttpClientConnection> createClientConnectionFactory() throws Exception {
-        return new LoggingClientConnectionFactory();
-    }
-
     @Test
     public void testGetRequestPipelining() throws Exception {
         this.server.start(this.serviceHandler);

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestTruncatedChunks.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestTruncatedChunks.java?rev=1599009&r1=1599008&r2=1599009&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestTruncatedChunks.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestTruncatedChunks.java Sun Jun  1 17:19:49 2014
@@ -45,14 +45,12 @@ import org.apache.http.entity.ContentLen
 import org.apache.http.entity.ContentType;
 import org.apache.http.entity.InputStreamEntity;
 import org.apache.http.impl.io.HttpTransportMetricsImpl;
-import org.apache.http.impl.nio.DefaultNHttpClientConnection;
 import org.apache.http.impl.nio.DefaultNHttpServerConnection;
 import org.apache.http.impl.nio.codecs.AbstractContentEncoder;
 import org.apache.http.message.BasicHttpRequest;
 import org.apache.http.nio.ContentDecoder;
 import org.apache.http.nio.ContentEncoder;
 import org.apache.http.nio.IOControl;
-import org.apache.http.nio.NHttpConnectionFactory;
 import org.apache.http.nio.entity.ContentInputStream;
 import org.apache.http.nio.protocol.AbstractAsyncResponseConsumer;
 import org.apache.http.nio.protocol.BasicAsyncRequestHandler;
@@ -63,8 +61,8 @@ import org.apache.http.nio.reactor.IOSes
 import org.apache.http.nio.reactor.ListenerEndpoint;
 import org.apache.http.nio.reactor.SessionOutputBuffer;
 import org.apache.http.nio.testserver.HttpCoreNIOTestBase;
-import org.apache.http.nio.testserver.LoggingClientConnectionFactory;
 import org.apache.http.nio.testserver.LoggingNHttpServerConnection;
+import org.apache.http.nio.testserver.ServerConnectionFactory;
 import org.apache.http.nio.util.HeapByteBufferAllocator;
 import org.apache.http.nio.util.SimpleInputBuffer;
 import org.apache.http.protocol.HttpContext;
@@ -93,15 +91,10 @@ public class TestTruncatedChunks extends
     }
 
     @Override
-    protected NHttpConnectionFactory<DefaultNHttpServerConnection> createServerConnectionFactory() throws Exception {
+    protected ServerConnectionFactory createServerConnectionFactory() throws Exception {
         return new CustomServerConnectionFactory();
     }
 
-    @Override
-    protected NHttpConnectionFactory<DefaultNHttpClientConnection> createClientConnectionFactory() throws Exception {
-        return new LoggingClientConnectionFactory();
-    }
-
     private static final byte[] GARBAGE = new byte[] {'1', '2', '3', '4', '5' };
 
     static class BrokenChunkEncoder extends AbstractContentEncoder {
@@ -147,7 +140,7 @@ public class TestTruncatedChunks extends
 
     }
 
-    static class CustomServerConnectionFactory implements NHttpConnectionFactory<DefaultNHttpServerConnection> {
+    static class CustomServerConnectionFactory extends ServerConnectionFactory {
 
         public CustomServerConnectionFactory() {
             super();

Copied: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ClientConnectionFactory.java (from r1598895, httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingSSLClientConnectionFactory.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ClientConnectionFactory.java?p2=httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ClientConnectionFactory.java&p1=httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingSSLClientConnectionFactory.java&r1=1598895&r2=1599009&rev=1599009&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingSSLClientConnectionFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ClientConnectionFactory.java Sun Jun  1 17:19:49 2014
@@ -35,28 +35,36 @@ import org.apache.http.nio.reactor.ssl.S
 import org.apache.http.nio.reactor.ssl.SSLMode;
 import org.apache.http.nio.reactor.ssl.SSLSetupHandler;
 
-public class LoggingSSLClientConnectionFactory implements NHttpConnectionFactory<DefaultNHttpClientConnection> {
+public class ClientConnectionFactory implements NHttpConnectionFactory<DefaultNHttpClientConnection> {
 
     private final SSLContext sslcontext;
     private final SSLSetupHandler setupHandler;
 
-    public LoggingSSLClientConnectionFactory(
+    public ClientConnectionFactory(
             final SSLContext sslcontext, final SSLSetupHandler setupHandler) {
         super();
         this.sslcontext = sslcontext;
         this.setupHandler = setupHandler;
     }
 
-    public LoggingSSLClientConnectionFactory(final SSLContext sslcontext) {
+    public ClientConnectionFactory(final SSLContext sslcontext) {
         this(sslcontext, null);
     }
 
+    public ClientConnectionFactory() {
+        this(null, null);
+    }
+
     @Override
     public DefaultNHttpClientConnection createConnection(final IOSession iosession) {
-        final SSLIOSession ssliosession = new SSLIOSession(
-                iosession, SSLMode.CLIENT, this.sslcontext, this.setupHandler);
-        iosession.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
-        return new LoggingNHttpClientConnection(ssliosession);
+        if (this.sslcontext != null) {
+            final SSLIOSession ssliosession = new SSLIOSession(
+                    iosession, SSLMode.CLIENT, this.sslcontext, this.setupHandler);
+            iosession.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
+            return new LoggingNHttpClientConnection(ssliosession);
+        } else {
+            return new LoggingNHttpClientConnection(iosession);
+        }
     }
 
 }

Propchange: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ClientConnectionFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ClientConnectionFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ClientConnectionFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/HttpCoreNIOTestBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/HttpCoreNIOTestBase.java?rev=1599009&r1=1599008&r2=1599009&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/HttpCoreNIOTestBase.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/HttpCoreNIOTestBase.java Sun Jun  1 17:19:49 2014
@@ -27,33 +27,45 @@
 
 package org.apache.http.nio.testserver;
 
-import org.apache.http.HttpHost;
-import org.apache.http.impl.nio.DefaultNHttpClientConnection;
-import org.apache.http.impl.nio.DefaultNHttpServerConnection;
 import org.apache.http.impl.nio.pool.BasicNIOConnFactory;
-import org.apache.http.nio.NHttpClientConnection;
-import org.apache.http.nio.NHttpConnectionFactory;
-import org.apache.http.nio.pool.NIOConnFactory;
 import org.junit.After;
 
 /**
- * Base class for all HttpCore NIO tests
+ * Base class for all HttpCore NIO integration tests
  *
  */
 public abstract class HttpCoreNIOTestBase {
 
+    public enum ProtocolScheme { http, https }
+
+    private final ProtocolScheme scheme;
+
     protected HttpServerNio server;
     protected HttpClientNio client;
 
-    protected abstract NHttpConnectionFactory<DefaultNHttpServerConnection>
-        createServerConnectionFactory() throws Exception;
+    public HttpCoreNIOTestBase(final ProtocolScheme scheme) {
+        this.scheme = scheme;
+    }
+
+    public HttpCoreNIOTestBase() {
+        this(ProtocolScheme.http);
+    }
+
+    public ProtocolScheme getScheme() {
+        return this.scheme;
+    }
+
+    protected ServerConnectionFactory createServerConnectionFactory() throws Exception {
+        return new ServerConnectionFactory(
+                this.scheme.equals(ProtocolScheme.https) ? SSLTestContexts.createServerSSLContext() : null);
+    }
 
-    protected abstract NHttpConnectionFactory<DefaultNHttpClientConnection>
-        createClientConnectionFactory() throws Exception;
+    protected BasicNIOConnFactory createClientConnectionFactory() throws Exception {
+        return new BasicNIOConnFactory(
+                new ClientConnectionFactory(),
+                this.scheme.equals(ProtocolScheme.https) ? new ClientConnectionFactory(
+                        SSLTestContexts.createClientSSLContext()) : null);
 
-    protected NIOConnFactory<HttpHost, NHttpClientConnection> createPoolConnectionFactory()
-        throws Exception {
-        return new BasicNIOConnFactory(createClientConnectionFactory(), null);
     }
 
     public void initServer() throws Exception {
@@ -63,7 +75,7 @@ public abstract class HttpCoreNIOTestBas
     }
 
     public void initClient() throws Exception {
-        this.client = new HttpClientNio(createPoolConnectionFactory());
+        this.client = new HttpClientNio(createClientConnectionFactory());
         this.client.setExceptionHandler(new SimpleIOReactorExceptionHandler());
         this.client.setTimeout(5000);
     }

Copied: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ServerConnectionFactory.java (from r1598895, httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingSSLServerConnectionFactory.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ServerConnectionFactory.java?p2=httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ServerConnectionFactory.java&p1=httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingSSLServerConnectionFactory.java&r1=1598895&r2=1599009&rev=1599009&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/LoggingSSLServerConnectionFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ServerConnectionFactory.java Sun Jun  1 17:19:49 2014
@@ -35,28 +35,36 @@ import org.apache.http.nio.reactor.ssl.S
 import org.apache.http.nio.reactor.ssl.SSLMode;
 import org.apache.http.nio.reactor.ssl.SSLSetupHandler;
 
-public class LoggingSSLServerConnectionFactory implements NHttpConnectionFactory<DefaultNHttpServerConnection> {
+public class ServerConnectionFactory implements NHttpConnectionFactory<DefaultNHttpServerConnection> {
 
     private final SSLContext sslcontext;
     private final SSLSetupHandler setupHandler;
 
-    public LoggingSSLServerConnectionFactory(
+    public ServerConnectionFactory(
             final SSLContext sslcontext, final SSLSetupHandler setupHandler) {
         super();
         this.sslcontext = sslcontext;
         this.setupHandler = setupHandler;
     }
 
-    public LoggingSSLServerConnectionFactory(final SSLContext sslcontext) {
+    public ServerConnectionFactory(final SSLContext sslcontext) {
         this(sslcontext, null);
     }
 
+    public ServerConnectionFactory() {
+        this(null, null);
+    }
+
     @Override
     public DefaultNHttpServerConnection createConnection(final IOSession iosession) {
-        final SSLIOSession ssliosession = new SSLIOSession(
-                iosession, SSLMode.SERVER, this.sslcontext, this.setupHandler);
-        iosession.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
-        return new LoggingNHttpServerConnection(ssliosession);
+        if (this.sslcontext != null) {
+            final SSLIOSession ssliosession = new SSLIOSession(
+                    iosession, SSLMode.SERVER, this.sslcontext, this.setupHandler);
+            iosession.setAttribute(SSLIOSession.SESSION_KEY, ssliosession);
+            return new LoggingNHttpServerConnection(ssliosession);
+        } else {
+            return new LoggingNHttpServerConnection(iosession);
+        }
     }
 
 }

Propchange: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ServerConnectionFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ServerConnectionFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/ServerConnectionFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message