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 2015/06/03 20:22:27 UTC

svn commit: r1683408 - in /httpcomponents/httpcore/trunk: httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/ httpcore-nio/src/test/java/org/apache/http/nio/integration/ httpcore-nio/src/test/java/org/apache/http/nio/testserver/ httpcore/src/t...

Author: olegk
Date: Wed Jun  3 18:22:27 2015
New Revision: 1683408

URL: http://svn.apache.org/r1683408
Log:
Refactored async integration testing framework and integration tests

Removed:
    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/testserver/SimpleIOReactorExceptionHandler.java
Modified:
    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/HttpClientNio.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/HttpCoreNIOTestBase.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/HttpServerNio.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/testserver/HttpClient.java

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=1683408&r1=1683407&r2=1683408&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 Wed Jun  3 18:22:27 2015
@@ -46,8 +46,6 @@ import org.apache.http.impl.nio.pool.Bas
 import org.apache.http.message.BasicHttpRequest;
 import org.apache.http.nio.NHttpConnection;
 import org.apache.http.nio.protocol.BasicAsyncRequestHandler;
-import org.apache.http.nio.protocol.UriHttpAsyncRequestHandlerMapper;
-import org.apache.http.nio.reactor.IOReactorStatus;
 import org.apache.http.nio.reactor.IOSession;
 import org.apache.http.nio.reactor.ListenerEndpoint;
 import org.apache.http.nio.reactor.ssl.SSLSetupHandler;
@@ -55,7 +53,6 @@ import org.apache.http.nio.testserver.Cl
 import org.apache.http.nio.testserver.HttpClientNio;
 import org.apache.http.nio.testserver.HttpServerNio;
 import org.apache.http.nio.testserver.ServerConnectionFactory;
-import org.apache.http.nio.testserver.SimpleIOReactorExceptionHandler;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpCoreContext;
 import org.apache.http.protocol.HttpRequestHandler;
@@ -125,29 +122,25 @@ public class TestCustomSSL {
                 .loadTrustMaterial(keyStoreURL, storePassword.toCharArray())
                 .loadKeyMaterial(keyStoreURL, storePassword.toCharArray(), storePassword.toCharArray())
                 .build();
-        this.server = new HttpServerNio(new ServerConnectionFactory(serverSSLContext, sslSetupHandler));
-        this.server.setExceptionHandler(new SimpleIOReactorExceptionHandler());
+        this.server = new HttpServerNio();
+        this.server.setConnectionFactory(new ServerConnectionFactory(serverSSLContext, sslSetupHandler));
         this.server.setTimeout(5000);
 
         final SSLContext clientSSLContext = SSLContextBuilder.create()
                 .loadTrustMaterial(keyStoreURL, storePassword.toCharArray())
                 .build();
 
-        this.client = new HttpClientNio(
-                new BasicNIOConnFactory(new ClientConnectionFactory(clientSSLContext), null));
-        this.client.setExceptionHandler(new SimpleIOReactorExceptionHandler());
+        this.client = new HttpClientNio(new BasicNIOConnFactory(new ClientConnectionFactory(clientSSLContext), null));
         this.client.setTimeout(5000);
 
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new BasicAsyncRequestHandler(requestHandler));
+        this.server.registerHandler("*", new BasicAsyncRequestHandler(requestHandler));
 
-        this.server.start(HttpServerNio.DEFAULT_HTTP_PROC, registry, null);
-        this.client.start(HttpClientNio.DEFAULT_HTTP_PROC);
+        this.server.start();
+        this.client.start();
 
         final ListenerEndpoint endpoint = this.server.getListenerEndpoint();
         endpoint.waitFor();
 
-        Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
         final InetSocketAddress address = (InetSocketAddress) endpoint.getAddress();
 
         final HttpHost target = new HttpHost("localhost", address.getPort());

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=1683408&r1=1683407&r2=1683408&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 Wed Jun  3 18:22:27 2015
@@ -51,8 +51,6 @@ import org.apache.http.nio.protocol.Http
 import org.apache.http.nio.protocol.HttpAsyncRequestConsumer;
 import org.apache.http.nio.protocol.HttpAsyncRequestHandler;
 import org.apache.http.nio.protocol.HttpAsyncResponseProducer;
-import org.apache.http.nio.protocol.UriHttpAsyncRequestHandlerMapper;
-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.protocol.HttpContext;
@@ -111,8 +109,7 @@ public class TestHttpAsyncHandlerCancell
 
         };
 
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new HttpAsyncRequestHandler<HttpRequest>() {
+        this.server.registerHandler("*", new HttpAsyncRequestHandler<HttpRequest>() {
 
             @Override
             public HttpAsyncRequestConsumer<HttpRequest> processRequest(
@@ -131,12 +128,11 @@ public class TestHttpAsyncHandlerCancell
             }
 
         });
-        this.server.start(registry);
+        this.server.start();
 
         final ListenerEndpoint endpoint = this.server.getListenerEndpoint();
         endpoint.waitFor();
 
-        Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
         final InetSocketAddress address = (InetSocketAddress) endpoint.getAddress();
         final Socket socket = new Socket("localhost", address.getPort());
         try {
@@ -170,8 +166,7 @@ public class TestHttpAsyncHandlerCancell
             }
         };
 
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new HttpAsyncRequestHandler<HttpRequest>() {
+        this.server.registerHandler("*", new HttpAsyncRequestHandler<HttpRequest>() {
 
             @Override
             public HttpAsyncRequestConsumer<HttpRequest> processRequest(
@@ -191,12 +186,11 @@ public class TestHttpAsyncHandlerCancell
             }
 
         });
-        this.server.start(registry);
+        this.server.start();
 
         final ListenerEndpoint endpoint = this.server.getListenerEndpoint();
         endpoint.waitFor();
 
-        Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
         final InetSocketAddress address = (InetSocketAddress) endpoint.getAddress();
         final Socket socket = new Socket("localhost", address.getPort());
         try {

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=1683408&r1=1683407&r2=1683408&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 Wed Jun  3 18:22:27 2015
@@ -56,15 +56,10 @@ import org.apache.http.nio.protocol.Http
 import org.apache.http.nio.protocol.HttpAsyncExpectationVerifier;
 import org.apache.http.nio.protocol.HttpAsyncRequestConsumer;
 import org.apache.http.nio.protocol.HttpAsyncRequestHandler;
-import org.apache.http.nio.protocol.HttpAsyncRequestHandlerMapper;
-import org.apache.http.nio.protocol.UriHttpAsyncRequestHandlerMapper;
-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.HttpServerNio;
 import org.apache.http.protocol.BasicHttpContext;
 import org.apache.http.protocol.HttpContext;
-import org.apache.http.protocol.HttpProcessor;
 import org.apache.http.protocol.HttpRequestHandler;
 import org.apache.http.protocol.ImmutableHttpProcessor;
 import org.apache.http.protocol.RequestConnControl;
@@ -110,28 +105,17 @@ public class TestHttpAsyncHandlers exten
         shutDownServer();
     }
 
-    private HttpHost start(
-            final HttpProcessor clientProtocolProcessor,
-            final HttpProcessor serverProtocolProcessor,
-            final HttpAsyncRequestHandlerMapper requestHandlerResolver,
-            final HttpAsyncExpectationVerifier expectationVerifier) throws Exception {
-        this.server.start(serverProtocolProcessor, requestHandlerResolver, expectationVerifier);
-        this.client.start(clientProtocolProcessor);
+    private HttpHost start() throws IOException, InterruptedException {
+        this.server.start();
+        this.client.start();
 
         final ListenerEndpoint endpoint = this.server.getListenerEndpoint();
         endpoint.waitFor();
 
-        Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
         final InetSocketAddress address = (InetSocketAddress) endpoint.getAddress();
         return new HttpHost("localhost", address.getPort(), getScheme().name());
     }
 
-    private HttpHost start(
-            final HttpAsyncRequestHandlerMapper requestHandlerResolver,
-            final HttpAsyncExpectationVerifier expectationVerifier) throws Exception {
-        return start(null, null, requestHandlerResolver, expectationVerifier);
-    }
-
     private static String createRequestUri(final String pattern, final int count) {
         return pattern + "x" + count;
     }
@@ -146,9 +130,8 @@ public class TestHttpAsyncHandlers exten
 
     @Test
     public void testHttpGets() throws Exception {
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final HttpHost target = start(registry, null);
+        this.server.registerHandler("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
+        final HttpHost target = start();
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -175,9 +158,8 @@ public class TestHttpAsyncHandlers exten
 
     @Test
     public void testHttpHeads() throws Exception {
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final HttpHost target = start(registry, null);
+        this.server.registerHandler("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
+        final HttpHost target = start();
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -202,9 +184,8 @@ public class TestHttpAsyncHandlers exten
 
     @Test
     public void testHttpPostsWithContentLength() throws Exception {
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final HttpHost target = start(registry, null);
+        this.server.registerHandler("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
+        final HttpHost target = start();
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -234,9 +215,8 @@ public class TestHttpAsyncHandlers exten
 
     @Test
     public void testHttpPostsChunked() throws Exception {
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final HttpHost target = start(registry, null);
+        this.server.registerHandler("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
+        final HttpHost target = start();
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -267,9 +247,8 @@ public class TestHttpAsyncHandlers exten
 
     @Test
     public void testHttpPostsHTTP10() throws Exception {
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final HttpHost target = start(registry, null);
+        this.server.registerHandler("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
+        final HttpHost target = start();
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -299,9 +278,8 @@ public class TestHttpAsyncHandlers exten
 
     @Test
     public void testHttpPostsNoEntity() throws Exception {
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final HttpHost target = start(registry, null);
+        this.server.registerHandler("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
+        final HttpHost target = start();
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -328,16 +306,15 @@ public class TestHttpAsyncHandlers exten
 
     @Test
     public void testHttpPostNoContentLength() throws Exception {
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
+        this.server.registerHandler("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
 
-        final HttpProcessor clientHttpProc = new ImmutableHttpProcessor(
+        this.client.setHttpProcessor(new ImmutableHttpProcessor(
                 new RequestTargetHost(),
                 new RequestConnControl(),
                 new RequestUserAgent(),
-                new RequestExpectContinue());
+                new RequestExpectContinue()));
 
-        final HttpHost target = start(clientHttpProc, null, registry, null);
+        final HttpHost target = start();
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -358,10 +335,9 @@ public class TestHttpAsyncHandlers exten
 
     @Test
     public void testHttpPostIdentity() throws Exception {
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
+        this.server.registerHandler("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
 
-        final HttpProcessor clientHttpProc = new ImmutableHttpProcessor(
+        this.client.setHttpProcessor(new ImmutableHttpProcessor(
                 new HttpRequestInterceptor() {
 
                     @Override
@@ -375,9 +351,9 @@ public class TestHttpAsyncHandlers exten
                 new RequestTargetHost(),
                 new RequestConnControl(),
                 new RequestUserAgent(),
-                new RequestExpectContinue());
+                new RequestExpectContinue()));
 
-        final HttpHost target = start(clientHttpProc, null, registry, null);
+        final HttpHost target = start();
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -398,9 +374,8 @@ public class TestHttpAsyncHandlers exten
 
     @Test
     public void testHttpPostsWithExpectContinue() throws Exception {
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final HttpHost target = start(registry, null);
+        this.server.registerHandler("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
+        final HttpHost target = start();
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -432,7 +407,8 @@ public class TestHttpAsyncHandlers exten
 
     @Test
     public void testHttpPostsWithExpectationVerification() throws Exception {
-        final HttpAsyncExpectationVerifier expectationVerifier = new HttpAsyncExpectationVerifier() {
+        this.server.registerHandler("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
+        this.server.setExpectationVerifier(new HttpAsyncExpectationVerifier() {
 
             @Override
             public void verify(
@@ -454,11 +430,9 @@ public class TestHttpAsyncHandlers exten
                 }
             }
 
-        };
+        });
 
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final HttpHost target = start(registry, expectationVerifier);
+        final HttpHost target = start();
 
         final BasicHttpRequest request1 = new BasicHttpRequest(
                 "POST", createRequestUri("AAAAA", 10));
@@ -539,9 +513,8 @@ public class TestHttpAsyncHandlers exten
 
         }
 
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new DelayedRequestHandler());
-        final HttpHost target = start(registry, null);
+        this.server.registerHandler("*", new DelayedRequestHandler());
+        final HttpHost target = start();
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -566,7 +539,8 @@ public class TestHttpAsyncHandlers exten
 
     @Test
     public void testHttpPostsWithExpectationVerificationDelayedResponse() throws Exception {
-        final HttpAsyncExpectationVerifier expectationVerifier = new HttpAsyncExpectationVerifier() {
+        this.server.registerHandler("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
+        this.server.setExpectationVerifier(new HttpAsyncExpectationVerifier() {
 
             @Override
             public void verify(
@@ -576,7 +550,10 @@ public class TestHttpAsyncHandlers exten
                     @Override
                     public void run() {
                         // Wait a bit, to make sure this is delayed.
-                        try { Thread.sleep(100); } catch(final InterruptedException ie) {}
+                        try {
+                            Thread.sleep(100);
+                        } catch (final InterruptedException ie) {
+                        }
                         // Set the entity after delaying...
                         final HttpRequest request = httpexchange.getRequest();
                         ProtocolVersion ver = request.getRequestLine().getProtocolVersion();
@@ -596,11 +573,8 @@ public class TestHttpAsyncHandlers exten
                 }.start();
             }
 
-        };
-
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final HttpHost target = start(registry, expectationVerifier);
+        });
+        final HttpHost target = start();
 
         final BasicHttpRequest request1 = new BasicHttpRequest(
                 "POST", createRequestUri("AAAAA", 10));
@@ -660,9 +634,8 @@ public class TestHttpAsyncHandlers exten
 
         }
 
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new FailingRequestHandler());
-        final HttpHost target = start(registry, null);
+        this.server.registerHandler("*", new FailingRequestHandler());
+        final HttpHost target = start();
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -687,8 +660,7 @@ public class TestHttpAsyncHandlers exten
 
     @Test
     public void testNoServiceHandler() throws Exception {
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        final HttpHost target = start(registry, null);
+        final HttpHost target = start();
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -713,8 +685,7 @@ public class TestHttpAsyncHandlers exten
 
     @Test
     public void testResponseNoContent() throws Exception {
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new BasicAsyncRequestHandler(new HttpRequestHandler() {
+        this.server.registerHandler("*", new BasicAsyncRequestHandler(new HttpRequestHandler() {
 
             @Override
             public void handle(
@@ -725,7 +696,7 @@ public class TestHttpAsyncHandlers exten
             }
 
         }));
-        final HttpHost target = start(registry, null);
+        final HttpHost target = start();
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -747,8 +718,7 @@ public class TestHttpAsyncHandlers exten
 
     @Test
     public void testAbsentHostHeader() throws Exception {
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new BasicAsyncRequestHandler(new HttpRequestHandler() {
+        this.server.registerHandler("*", new BasicAsyncRequestHandler(new HttpRequestHandler() {
 
             @Override
             public void handle(
@@ -760,9 +730,8 @@ public class TestHttpAsyncHandlers exten
             }
 
         }));
-        final HttpHost target = start(
-                new ImmutableHttpProcessor(new RequestContent(), new RequestConnControl()),
-                HttpServerNio.DEFAULT_HTTP_PROC, registry, null);
+        this.client.setHttpProcessor(new ImmutableHttpProcessor(new RequestContent(), new RequestConnControl()));
+        final HttpHost target = start();
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);

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=1683408&r1=1683407&r2=1683408&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 Wed Jun  3 18:22:27 2015
@@ -57,14 +57,10 @@ import org.apache.http.nio.protocol.Basi
 import org.apache.http.nio.protocol.BasicAsyncResponseConsumer;
 import org.apache.http.nio.protocol.BasicAsyncResponseProducer;
 import org.apache.http.nio.protocol.HttpAsyncExchange;
-import org.apache.http.nio.protocol.HttpAsyncExpectationVerifier;
 import org.apache.http.nio.protocol.HttpAsyncRequestConsumer;
 import org.apache.http.nio.protocol.HttpAsyncRequestHandler;
-import org.apache.http.nio.protocol.HttpAsyncRequestHandlerMapper;
 import org.apache.http.nio.protocol.HttpAsyncRequestProducer;
 import org.apache.http.nio.protocol.HttpAsyncResponseConsumer;
-import org.apache.http.nio.protocol.UriHttpAsyncRequestHandlerMapper;
-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.protocol.HttpContext;
@@ -119,28 +115,18 @@ public class TestHttpAsyncHandlersPipeli
         shutDownServer();
     }
 
-    private HttpHost start(
-            final HttpProcessor clientProtocolProcessor,
-            final HttpProcessor serverProtocolProcessor,
-            final HttpAsyncRequestHandlerMapper requestHandlerResolver,
-            final HttpAsyncExpectationVerifier expectationVerifier) throws Exception {
-        this.server.start(serverProtocolProcessor, requestHandlerResolver, expectationVerifier);
-        this.client.start(clientProtocolProcessor);
+    private HttpHost start() throws Exception {
+        this.server.start();
+        this.client.setHttpProcessor(DEFAULT_HTTP_PROC);
+        this.client.start();
 
         final ListenerEndpoint endpoint = this.server.getListenerEndpoint();
         endpoint.waitFor();
 
-        Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
         final InetSocketAddress address = (InetSocketAddress) endpoint.getAddress();
         return new HttpHost("localhost", address.getPort(), getScheme().name());
     }
 
-    private HttpHost start(
-            final HttpAsyncRequestHandlerMapper requestHandlerResolver,
-            final HttpAsyncExpectationVerifier expectationVerifier) throws Exception {
-        return start(DEFAULT_HTTP_PROC, null, requestHandlerResolver, expectationVerifier);
-    }
-
     private static String createRequestUri(final String pattern, final int count) {
         return pattern + "x" + count;
     }
@@ -155,9 +141,8 @@ public class TestHttpAsyncHandlersPipeli
 
     @Test
     public void testHttpGets() throws Exception {
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final HttpHost target = start(registry, null);
+        this.server.registerHandler("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
+        final HttpHost target = start();
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -191,9 +176,8 @@ public class TestHttpAsyncHandlersPipeli
 
     @Test
     public void testHttpHeads() throws Exception {
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final HttpHost target = start(registry, null);
+        this.server.registerHandler("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
+        final HttpHost target = start();
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -224,9 +208,8 @@ public class TestHttpAsyncHandlersPipeli
 
     @Test
     public void testHttpPosts() throws Exception {
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
-        final HttpHost target = start(registry, null);
+        this.server.registerHandler("*", new BasicAsyncRequestHandler(new SimpleRequestHandler()));
+        final HttpHost target = start();
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -311,9 +294,8 @@ public class TestHttpAsyncHandlersPipeli
 
         }
 
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new DelayedRequestHandler());
-        final HttpHost target = start(registry, null);
+        this.server.registerHandler("*", new DelayedRequestHandler());
+        final HttpHost target = start();
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);
@@ -361,8 +343,7 @@ public class TestHttpAsyncHandlersPipeli
 
     @Test
     public void testUnexpectedConnectionClosure() throws Exception {
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new BasicAsyncRequestHandler(new HttpRequestHandler() {
+        this.server.registerHandler("*", new BasicAsyncRequestHandler(new HttpRequestHandler() {
 
             @Override
             public void handle(
@@ -374,7 +355,7 @@ public class TestHttpAsyncHandlersPipeli
             }
 
         }));
-        registry.register("/boom", new BasicAsyncRequestHandler(new HttpRequestHandler() {
+        this.server.registerHandler("/boom", new BasicAsyncRequestHandler(new HttpRequestHandler() {
 
             @Override
             public void handle(
@@ -387,7 +368,7 @@ public class TestHttpAsyncHandlersPipeli
             }
 
         }));
-        final HttpHost target = start(registry, null);
+        final HttpHost target = start();
 
         this.client.setMaxPerRoute(3);
         this.client.setMaxTotal(3);

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=1683408&r1=1683407&r2=1683408&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 Wed Jun  3 18:22:27 2015
@@ -49,12 +49,8 @@ import org.apache.http.nio.entity.NStrin
 import org.apache.http.nio.protocol.BasicAsyncRequestConsumer;
 import org.apache.http.nio.protocol.BasicAsyncResponseProducer;
 import org.apache.http.nio.protocol.HttpAsyncExchange;
-import org.apache.http.nio.protocol.HttpAsyncExpectationVerifier;
 import org.apache.http.nio.protocol.HttpAsyncRequestConsumer;
 import org.apache.http.nio.protocol.HttpAsyncRequestHandler;
-import org.apache.http.nio.protocol.HttpAsyncRequestHandlerMapper;
-import org.apache.http.nio.protocol.UriHttpAsyncRequestHandlerMapper;
-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.protocol.BasicHttpContext;
@@ -79,23 +75,19 @@ public class TestHttpAsyncPrematureTermi
         shutDownServer();
     }
 
-    private InetSocketAddress start(
-            final HttpAsyncRequestHandlerMapper requestHandlerResolver,
-            final HttpAsyncExpectationVerifier expectationVerifier) throws Exception {
-        this.server.start(requestHandlerResolver, expectationVerifier);
+    private InetSocketAddress start() throws Exception {
+        this.server.start();
         this.client.start();
 
         final ListenerEndpoint endpoint = this.server.getListenerEndpoint();
         endpoint.waitFor();
 
-        Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
         return (InetSocketAddress) endpoint.getAddress();
     }
 
     @Test
     public void testConnectionTerminatedProcessingRequest() throws Exception {
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new HttpAsyncRequestHandler<HttpRequest>() {
+        this.server.registerHandler("*", new HttpAsyncRequestHandler<HttpRequest>() {
 
             @Override
             public HttpAsyncRequestConsumer<HttpRequest> processRequest(
@@ -118,7 +110,7 @@ public class TestHttpAsyncPrematureTermi
             }
 
         });
-        final InetSocketAddress address = start(registry, null);
+        final InetSocketAddress address = start();
         final HttpHost target = new HttpHost("localhost", address.getPort());
 
         final CountDownLatch latch = new CountDownLatch(1);
@@ -151,7 +143,6 @@ public class TestHttpAsyncPrematureTermi
 
     @Test
     public void testConnectionTerminatedHandlingRequest() throws Exception {
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
         final CountDownLatch responseStreamClosed = new CountDownLatch(1);
         final InputStream testInputStream = new ByteArrayInputStream(
                 "all is well".getBytes(Consts.ASCII)) {
@@ -161,7 +152,7 @@ public class TestHttpAsyncPrematureTermi
                 super.close();
             }
         };
-        registry.register("*", new HttpAsyncRequestHandler<HttpRequest>() {
+        this.server.registerHandler("*", new HttpAsyncRequestHandler<HttpRequest>() {
 
             @Override
             public HttpAsyncRequestConsumer<HttpRequest> processRequest(
@@ -184,7 +175,7 @@ public class TestHttpAsyncPrematureTermi
             }
 
         });
-        final InetSocketAddress address = start(registry, null);
+        final InetSocketAddress address = start();
         final HttpHost target = new HttpHost("localhost", address.getPort());
 
         final CountDownLatch latch = new CountDownLatch(1);
@@ -218,8 +209,7 @@ public class TestHttpAsyncPrematureTermi
 
     @Test
     public void testConnectionTerminatedSendingResponse() throws Exception {
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new HttpAsyncRequestHandler<HttpRequest>() {
+        this.server.registerHandler("*", new HttpAsyncRequestHandler<HttpRequest>() {
 
             @Override
             public HttpAsyncRequestConsumer<HttpRequest> processRequest(
@@ -248,7 +238,7 @@ public class TestHttpAsyncPrematureTermi
             }
 
         });
-        final InetSocketAddress address = start(registry, null);
+        final InetSocketAddress address = start();
         final HttpHost target = new HttpHost("localhost", address.getPort());
 
         final CountDownLatch latch = new CountDownLatch(1);

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=1683408&r1=1683407&r2=1683408&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 Wed Jun  3 18:22:27 2015
@@ -40,7 +40,6 @@ import org.apache.http.concurrent.Future
 import org.apache.http.message.BasicHttpRequest;
 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.protocol.BasicHttpContext;
 import org.apache.http.protocol.HttpContext;
@@ -70,8 +69,7 @@ public class TestHttpsAsyncTimeout exten
 
     private InetSocketAddress start() throws Exception {
 
-        final HttpAsyncRequestExecutor clientHandler = new HttpAsyncRequestExecutor();
-        this.client.start(clientHandler);
+        this.client.start();
         serverSocket = new ServerSocket(0);
         return new InetSocketAddress(serverSocket.getInetAddress(), serverSocket.getLocalPort());
     }

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=1683408&r1=1683407&r2=1683408&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 Wed Jun  3 18:22:27 2015
@@ -46,13 +46,10 @@ import org.apache.http.entity.ContentTyp
 import org.apache.http.nio.entity.NByteArrayEntity;
 import org.apache.http.nio.entity.NStringEntity;
 import org.apache.http.nio.protocol.BasicAsyncRequestHandler;
-import org.apache.http.nio.protocol.HttpAsyncService;
 import org.apache.http.nio.protocol.UriHttpAsyncRequestHandlerMapper;
-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.protocol.HttpContext;
-import org.apache.http.protocol.HttpProcessor;
 import org.apache.http.protocol.HttpRequestHandler;
 import org.apache.http.protocol.ImmutableHttpProcessor;
 import org.apache.http.protocol.ResponseConnControl;
@@ -69,16 +66,13 @@ import org.junit.Test;
  */
 public class TestServerSidePipelining extends HttpCoreNIOTestBase {
 
-    protected HttpProcessor serverHttpProc;
-    protected HttpAsyncService serviceHandler;
-
     @Before
     public void setUp() throws Exception {
         initServer();
-        this.serverHttpProc = new ImmutableHttpProcessor(
-                new ResponseServer("TEST-SERVER/1.1"), new ResponseContent(), new ResponseConnControl());
+        this.server.setHttpProcessor(new ImmutableHttpProcessor(
+                new ResponseServer("TEST-SERVER/1.1"), new ResponseContent(), new ResponseConnControl()));
         final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new BasicAsyncRequestHandler(new HttpRequestHandler() {
+        this.server.registerHandler("*", new BasicAsyncRequestHandler(new HttpRequestHandler() {
 
             @Override
             public void handle(
@@ -91,7 +85,7 @@ public class TestServerSidePipelining ex
             }
 
         }));
-        registry.register("/goodbye", new BasicAsyncRequestHandler(new HttpRequestHandler() {
+        this.server.registerHandler("/goodbye", new BasicAsyncRequestHandler(new HttpRequestHandler() {
 
             @Override
             public void handle(
@@ -105,7 +99,7 @@ public class TestServerSidePipelining ex
             }
 
         }));
-        registry.register("/echo", new BasicAsyncRequestHandler(new HttpRequestHandler() {
+        this.server.registerHandler("/echo", new BasicAsyncRequestHandler(new HttpRequestHandler() {
 
             @Override
             public void handle(
@@ -125,7 +119,6 @@ public class TestServerSidePipelining ex
             }
 
         }));
-        this.serviceHandler = new HttpAsyncService(this.serverHttpProc, registry);
     }
 
     @After
@@ -135,13 +128,11 @@ public class TestServerSidePipelining ex
 
     @Test
     public void testGetRequestPipelining() throws Exception {
-        this.server.start(this.serviceHandler);
+        this.server.start();
 
         final ListenerEndpoint endpoint = this.server.getListenerEndpoint();
         endpoint.waitFor();
 
-        Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
-
         final InetSocketAddress address = (InetSocketAddress) endpoint.getAddress();
         final Socket socket = new Socket("localhost", address.getPort());
         try {
@@ -207,13 +198,11 @@ public class TestServerSidePipelining ex
 
     @Test
     public void testPostRequestPipelining() throws Exception {
-        this.server.start(this.serviceHandler);
+        this.server.start();
 
         final ListenerEndpoint endpoint = this.server.getListenerEndpoint();
         endpoint.waitFor();
 
-        Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
-
         final InetSocketAddress address = (InetSocketAddress) endpoint.getAddress();
         final Socket socket = new Socket("localhost", address.getPort());
         try {
@@ -288,13 +277,11 @@ public class TestServerSidePipelining ex
 
     @Test
     public void testPostRequestPipeliningExpectContinue() throws Exception {
-        this.server.start(this.serviceHandler);
+        this.server.start();
 
         final ListenerEndpoint endpoint = this.server.getListenerEndpoint();
         endpoint.waitFor();
 
-        Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
-
         final InetSocketAddress address = (InetSocketAddress) endpoint.getAddress();
         final Socket socket = new Socket("localhost", address.getPort());
         try {

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=1683408&r1=1683407&r2=1683408&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 Wed Jun  3 18:22:27 2015
@@ -55,8 +55,6 @@ import org.apache.http.nio.entity.Conten
 import org.apache.http.nio.protocol.AbstractAsyncResponseConsumer;
 import org.apache.http.nio.protocol.BasicAsyncRequestHandler;
 import org.apache.http.nio.protocol.BasicAsyncRequestProducer;
-import org.apache.http.nio.protocol.UriHttpAsyncRequestHandlerMapper;
-import org.apache.http.nio.reactor.IOReactorStatus;
 import org.apache.http.nio.reactor.IOSession;
 import org.apache.http.nio.reactor.ListenerEndpoint;
 import org.apache.http.nio.reactor.SessionOutputBuffer;
@@ -170,16 +168,13 @@ public class TestTruncatedChunks extends
 
     @Test
     public void testTruncatedChunkException() throws Exception {
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler(true)));
-        this.server.start(registry);
+        this.server.registerHandler("*", new BasicAsyncRequestHandler(new SimpleRequestHandler(true)));
+        this.server.start();
         this.client.start();
 
         final ListenerEndpoint endpoint = this.server.getListenerEndpoint();
         endpoint.waitFor();
 
-        Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
-
         final String pattern = RndTestPatternGenerator.generateText();
         final int count = RndTestPatternGenerator.generateCount(1000);
 
@@ -246,16 +241,13 @@ public class TestTruncatedChunks extends
 
     @Test
     public void testIgnoreTruncatedChunkException() throws Exception {
-        final UriHttpAsyncRequestHandlerMapper registry = new UriHttpAsyncRequestHandlerMapper();
-        registry.register("*", new BasicAsyncRequestHandler(new SimpleRequestHandler(true)));
-        this.server.start(registry);
+        this.server.registerHandler("*", new BasicAsyncRequestHandler(new SimpleRequestHandler(true)));
+        this.server.start();
         this.client.start();
 
         final ListenerEndpoint endpoint = this.server.getListenerEndpoint();
         endpoint.waitFor();
 
-        Assert.assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
-
         final String pattern = RndTestPatternGenerator.generateText();
         final int count = RndTestPatternGenerator.generateCount(1000);
 

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/HttpClientNio.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/HttpClientNio.java?rev=1683408&r1=1683407&r2=1683408&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/HttpClientNio.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/HttpClientNio.java Wed Jun  3 18:22:27 2015
@@ -37,8 +37,8 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
-import org.apache.http.HttpRequestInterceptor;
 import org.apache.http.HttpResponse;
+import org.apache.http.OoopsieRuntimeException;
 import org.apache.http.concurrent.FutureCallback;
 import org.apache.http.config.ConnectionConfig;
 import org.apache.http.impl.nio.DefaultHttpClientIODispatch;
@@ -76,17 +76,17 @@ import org.apache.http.protocol.RequestU
 public class HttpClientNio {
 
     public static final HttpProcessor DEFAULT_HTTP_PROC = new ImmutableHttpProcessor(
-            new HttpRequestInterceptor[] {
-                    new RequestContent(),
-                    new RequestTargetHost(),
-                    new RequestConnControl(),
-                    new RequestUserAgent("TEST-CLIENT/1.1"),
-                    new RequestExpectContinue()});
+            new RequestContent(),
+            new RequestTargetHost(),
+            new RequestConnControl(),
+            new RequestUserAgent("TEST-CLIENT/1.1"),
+            new RequestExpectContinue());
 
     private final DefaultConnectingIOReactor ioReactor;
     private final BasicNIOConnPool connpool;
 
-    private volatile  HttpAsyncRequester executor;
+    private volatile HttpProcessor httpProcessor;
+    private volatile HttpAsyncRequester executor;
     private volatile IOReactorThread thread;
     private volatile int timeout;
 
@@ -94,6 +94,7 @@ public class HttpClientNio {
             final NIOConnFactory<HttpHost, NHttpClientConnection> connFactory) throws IOException {
         super();
         this.ioReactor = new DefaultConnectingIOReactor();
+        this.ioReactor.setExceptionHandler(new SimpleIOReactorExceptionHandler());
         this.connpool = new BasicNIOConnPool(this.ioReactor, new NIOConnFactory<HttpHost, NHttpClientConnection>() {
 
             @Override
@@ -123,6 +124,10 @@ public class HttpClientNio {
         this.connpool.setDefaultMaxPerRoute(max);
     }
 
+    public void setHttpProcessor(final HttpProcessor httpProcessor) {
+        this.httpProcessor = httpProcessor;
+    }
+
     public Future<BasicNIOPoolEntry> lease(
             final HttpHost host,
             final FutureCallback<BasicNIOPoolEntry> callback) {
@@ -207,10 +212,6 @@ public class HttpClientNio {
         return executePipelined(target, Arrays.asList(requests), null, null);
     }
 
-    public void setExceptionHandler(final IOReactorExceptionHandler exceptionHandler) {
-        this.ioReactor.setExceptionHandler(exceptionHandler);
-    }
-
     private void execute(final NHttpClientEventHandler clientHandler) throws IOException {
         final IOEventDispatch ioEventDispatch = new DefaultHttpClientIODispatch(clientHandler,
             new DefaultNHttpClientConnectionFactory(ConnectionConfig.DEFAULT)) {
@@ -232,27 +233,10 @@ public class HttpClientNio {
         return sessionRequest;
     }
 
-    public void start(
-            final HttpProcessor protocolProcessor,
-            final NHttpClientEventHandler clientHandler) {
-        this.executor = new HttpAsyncRequester(protocolProcessor != null ? protocolProcessor :
-            DEFAULT_HTTP_PROC);
-        this.thread = new IOReactorThread(clientHandler);
-        this.thread.start();
-    }
-
-    public void start(
-            final HttpProcessor protocolProcessor) {
-        start(protocolProcessor, new HttpAsyncRequestExecutor());
-    }
-
-    public void start(
-            final NHttpClientEventHandler clientHandler) {
-        start(null, clientHandler);
-    }
-
     public void start() {
-        start(null, new HttpAsyncRequestExecutor());
+        this.executor = new HttpAsyncRequester(this.httpProcessor != null ? this.httpProcessor : DEFAULT_HTTP_PROC);
+        this.thread = new IOReactorThread(new HttpAsyncRequestExecutor());
+        this.thread.start();
     }
 
     public ConnectingIOReactor getIoReactor() {
@@ -314,5 +298,23 @@ public class HttpClientNio {
         }
 
     }
+
+    static class SimpleIOReactorExceptionHandler implements IOReactorExceptionHandler {
+
+        @Override
+        public boolean handle(final RuntimeException ex) {
+            if (!(ex instanceof OoopsieRuntimeException)) {
+                ex.printStackTrace(System.out);
+            }
+            return false;
+        }
+
+        @Override
+        public boolean handle(final IOException ex) {
+            ex.printStackTrace(System.out);
+            return false;
+        }
+
+    }
 
 }

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=1683408&r1=1683407&r2=1683408&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 Wed Jun  3 18:22:27 2015
@@ -90,14 +90,13 @@ public abstract class HttpCoreNIOTestBas
     }
 
     public void initServer() throws Exception {
-        this.server = new HttpServerNio(createServerConnectionFactory());
-        this.server.setExceptionHandler(new SimpleIOReactorExceptionHandler());
+        this.server = new HttpServerNio();
+        this.server.setConnectionFactory(createServerConnectionFactory());
         this.server.setTimeout(5000);
     }
 
     public void initClient() throws Exception {
         this.client = new HttpClientNio(createClientConnectionFactory());
-        this.client.setExceptionHandler(new SimpleIOReactorExceptionHandler());
         this.client.setTimeout(5000);
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/HttpServerNio.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/HttpServerNio.java?rev=1683408&r1=1683407&r2=1683408&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/HttpServerNio.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/testserver/HttpServerNio.java Wed Jun  3 18:22:27 2015
@@ -28,56 +28,39 @@
 package org.apache.http.nio.testserver;
 
 import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.util.Arrays;
-import java.util.List;
+import java.net.SocketException;
+import java.util.concurrent.TimeUnit;
 
-import org.apache.http.HttpRequestInterceptor;
-import org.apache.http.impl.nio.DefaultHttpServerIODispatch;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.http.ConnectionClosedException;
+import org.apache.http.ExceptionLogger;
 import org.apache.http.impl.nio.DefaultNHttpServerConnection;
-import org.apache.http.impl.nio.reactor.DefaultListeningIOReactor;
-import org.apache.http.impl.nio.reactor.ExceptionEvent;
+import org.apache.http.impl.nio.bootstrap.HttpServer;
+import org.apache.http.impl.nio.bootstrap.ServerBootstrap;
+import org.apache.http.impl.nio.reactor.IOReactorConfig;
 import org.apache.http.nio.NHttpConnectionFactory;
-import org.apache.http.nio.NHttpServerEventHandler;
 import org.apache.http.nio.protocol.HttpAsyncExpectationVerifier;
-import org.apache.http.nio.protocol.HttpAsyncRequestHandlerMapper;
-import org.apache.http.nio.protocol.HttpAsyncService;
-import org.apache.http.nio.reactor.IOEventDispatch;
-import org.apache.http.nio.reactor.IOReactorExceptionHandler;
-import org.apache.http.nio.reactor.IOReactorStatus;
-import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.nio.protocol.HttpAsyncRequestHandler;
+import org.apache.http.nio.protocol.UriHttpAsyncRequestHandlerMapper;
 import org.apache.http.nio.reactor.ListenerEndpoint;
-import org.apache.http.nio.reactor.ListeningIOReactor;
 import org.apache.http.protocol.HttpProcessor;
-import org.apache.http.protocol.ImmutableHttpProcessor;
-import org.apache.http.protocol.RequestValidateHost;
-import org.apache.http.protocol.ResponseConnControl;
-import org.apache.http.protocol.ResponseContent;
-import org.apache.http.protocol.ResponseDate;
-import org.apache.http.protocol.ResponseServer;
+import org.apache.http.util.Asserts;
 
 public class HttpServerNio {
 
-    public static final HttpProcessor DEFAULT_HTTP_PROC = new ImmutableHttpProcessor(
-            Arrays.<HttpRequestInterceptor>asList(new RequestValidateHost()),
-            Arrays.asList(
-                    new ResponseDate(),
-                    new ResponseServer("TEST-SERVER/1.1"),
-                    new ResponseContent(),
-                    new ResponseConnControl()));
+    private final UriHttpAsyncRequestHandlerMapper reqistry;
+    private volatile HttpAsyncExpectationVerifier expectationVerifier;
+    private volatile NHttpConnectionFactory<DefaultNHttpServerConnection> connectionFactory;
+    private volatile HttpProcessor httpProcessor;
 
-    private final DefaultListeningIOReactor ioReactor;
-    private final NHttpConnectionFactory<DefaultNHttpServerConnection> connFactory;
-
-    private volatile IOReactorThread thread;
-    private volatile ListenerEndpoint endpoint;
     private volatile int timeout;
 
-    public HttpServerNio(
-            final NHttpConnectionFactory<DefaultNHttpServerConnection> connFactory) throws IOException {
+    private volatile HttpServer server;
+
+    public HttpServerNio() throws IOException {
         super();
-        this.ioReactor = new DefaultListeningIOReactor();
-        this.connFactory = connFactory;
+        this.reqistry = new UriHttpAsyncRequestHandlerMapper();
     }
 
     public int getTimeout() {
@@ -88,114 +71,71 @@ public class HttpServerNio {
         this.timeout = timeout;
     }
 
-    public void setExceptionHandler(final IOReactorExceptionHandler exceptionHandler) {
-        this.ioReactor.setExceptionHandler(exceptionHandler);
-    }
-
-    private void execute(final NHttpServerEventHandler serviceHandler) throws IOException {
-        final IOEventDispatch ioEventDispatch = new DefaultHttpServerIODispatch(serviceHandler, this.connFactory) {
-
-            @Override
-            protected DefaultNHttpServerConnection createConnection(final IOSession session) {
-                final DefaultNHttpServerConnection conn = super.createConnection(session);
-                conn.setSocketTimeout(timeout);
-                return conn;
-            }
-
-        };
-        this.ioReactor.execute(ioEventDispatch);
-    }
-
-    public ListenerEndpoint getListenerEndpoint() {
-        return this.endpoint;
-    }
-
-    public void setEndpoint(final ListenerEndpoint endpoint) {
-        this.endpoint = endpoint;
-    }
-
-    public void start(final NHttpServerEventHandler serviceHandler) {
-        this.endpoint = this.ioReactor.listen(new InetSocketAddress(0));
-        this.thread = new IOReactorThread(serviceHandler);
-        this.thread.start();
-    }
-
-    public void start(
-            final HttpProcessor protocolProcessor,
-            final HttpAsyncRequestHandlerMapper handlerMapper,
-            final HttpAsyncExpectationVerifier expectationVerifier) {
-        start(new HttpAsyncService(protocolProcessor != null ? protocolProcessor :
-            DEFAULT_HTTP_PROC, null, null, handlerMapper, expectationVerifier));
-    }
-
-    public void start(
-            final HttpAsyncRequestHandlerMapper handlerMapper,
-            final HttpAsyncExpectationVerifier expectationVerifier) {
-        start(null, handlerMapper, expectationVerifier);
-    }
-
-    public void start(final HttpAsyncRequestHandlerMapper handlerMapper) {
-        start(null, handlerMapper, null);
+    public void registerHandler(
+            final String pattern,
+            final HttpAsyncRequestHandler handler) {
+        this.reqistry.register(pattern, handler);
     }
 
-    public ListeningIOReactor getIoReactor() {
-        return this.ioReactor;
+    public void setExpectationVerifier(final HttpAsyncExpectationVerifier expectationVerifier) {
+        this.expectationVerifier = expectationVerifier;
     }
 
-    public IOReactorStatus getStatus() {
-        return this.ioReactor.getStatus();
+    public void setConnectionFactory(final NHttpConnectionFactory<DefaultNHttpServerConnection> connectionFactory) {
+        this.connectionFactory = connectionFactory;
     }
 
-    public List<ExceptionEvent> getAuditLog() {
-        return this.ioReactor.getAuditLog();
+    public void setHttpProcessor(final HttpProcessor httpProcessor) {
+        this.httpProcessor = httpProcessor;
     }
 
-    public void join(final long timeout) throws InterruptedException {
-        if (this.thread != null) {
-            this.thread.join(timeout);
+    public ListenerEndpoint getListenerEndpoint() {
+        final HttpServer local = this.server;
+        if (local != null) {
+            return this.server.getEndpoint();
+        } else {
+            throw new IllegalStateException("Server not running");
         }
     }
 
-    public Exception getException() {
-        if (this.thread != null) {
-            return this.thread.getException();
-        } else {
-            return null;
-        }
+    public void start() throws IOException {
+        Asserts.check(this.server == null, "Server already running");
+        this.server = ServerBootstrap.bootstrap()
+                .setIOReactorConfig(IOReactorConfig.custom()
+                        .setSoTimeout(this.timeout)
+                        .build())
+                .setServerInfo("TEST-SERVER/1.1")
+                .setConnectionFactory(connectionFactory)
+                .setExceptionLogger(new SimpleExceptionLogger())
+                .setExpectationVerifier(this.expectationVerifier)
+                .setHttpProcessor(this.httpProcessor)
+                .setHandlerMapper(this.reqistry)
+                .create();
+        this.server.start();
     }
 
-    public void shutdown() throws IOException {
-        this.ioReactor.shutdown();
-        try {
-            join(500);
-        } catch (final InterruptedException ignore) {
+    public void shutdown() {
+        final HttpServer local = this.server;
+        this.server = null;
+        if (local != null) {
+            local.shutdown(5, TimeUnit.SECONDS);
         }
     }
 
-    private class IOReactorThread extends Thread {
-
-        private final NHttpServerEventHandler serviceHandler;
+    static class SimpleExceptionLogger implements ExceptionLogger {
 
-        private volatile Exception ex;
-
-        public IOReactorThread(final NHttpServerEventHandler serviceHandler) {
-            super();
-            this.serviceHandler = serviceHandler;
-        }
+        private final Log log = LogFactory.getLog(HttpServer.class);
 
         @Override
-        public void run() {
-            try {
-                execute(this.serviceHandler);
-            } catch (final Exception ex) {
-                this.ex = ex;
+        public void log(final Exception ex) {
+            if (ex instanceof ConnectionClosedException) {
+                this.log.debug(ex.getMessage());
+            } else if (ex instanceof SocketException) {
+                this.log.debug(ex.getMessage());
+            } else {
+                this.log.error(ex.getMessage(), ex);
             }
         }
-
-        public Exception getException() {
-            return this.ex;
-        }
-
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/testserver/HttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/testserver/HttpClient.java?rev=1683408&r1=1683407&r2=1683408&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/testserver/HttpClient.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/testserver/HttpClient.java Wed Jun  3 18:22:27 2015
@@ -36,7 +36,6 @@ import org.apache.http.HttpClientConnect
 import org.apache.http.HttpException;
 import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
-import org.apache.http.HttpRequestInterceptor;
 import org.apache.http.HttpResponse;
 import org.apache.http.impl.DefaultBHttpClientConnection;
 import org.apache.http.impl.DefaultConnectionReuseStrategy;
@@ -70,13 +69,11 @@ public class HttpClient {
 
     public HttpClient() {
         this(new ImmutableHttpProcessor(
-                new HttpRequestInterceptor[] {
-                        new RequestContent(),
-                        new RequestTargetHost(),
-                        new RequestConnControl(),
-                        new RequestUserAgent("TEST-CLIENT/1.1"),
-                        new RequestExpectContinue()
-                }));
+                new RequestContent(),
+                new RequestTargetHost(),
+                new RequestConnControl(),
+                new RequestUserAgent("TEST-CLIENT/1.1"),
+                new RequestExpectContinue()));
     }
 
     public HttpContext getContext() {