hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1225504 - /httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/
Date Thu, 29 Dec 2011 12:09:56 GMT
Author: olegk
Date: Thu Dec 29 12:09:56 2011
New Revision: 1225504

URL: http://svn.apache.org/viewvc?rev=1225504&view=rev
Log:
Renamed test cases to match new class names

Added:
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequester.java
      - copied, changed from r1225503, httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java   (contents, props changed)
      - copied, changed from r1225503, httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncServerProtocolHandler.java
Removed:
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncClientProtocolHandler.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncServerProtocolHandler.java
Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java?rev=1225504&r1=1225503&r2=1225504&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java Thu Dec 29 12:09:56 2011
@@ -27,60 +27,57 @@
 
 package org.apache.http.nio.protocol;
 
-import java.util.concurrent.Future;
+import java.io.IOException;
+import java.net.SocketTimeoutException;
 
 import junit.framework.Assert;
 
 import org.apache.http.ConnectionReuseStrategy;
-import org.apache.http.HttpHost;
-import org.apache.http.concurrent.FutureCallback;
-import org.apache.http.impl.nio.pool.BasicNIOPoolEntry;
+import org.apache.http.HttpException;
+import org.apache.http.HttpRequest;
+import org.apache.http.HttpStatus;
+import org.apache.http.HttpVersion;
+import org.apache.http.message.BasicHttpEntityEnclosingRequest;
+import org.apache.http.message.BasicHttpRequest;
+import org.apache.http.message.BasicHttpResponse;
+import org.apache.http.nio.ContentDecoder;
+import org.apache.http.nio.ContentEncoder;
 import org.apache.http.nio.NHttpClientConnection;
-import org.apache.http.nio.protocol.HttpAsyncRequester.ConnRequestCallback;
-import org.apache.http.params.BasicHttpParams;
-import org.apache.http.params.HttpParams;
-import org.apache.http.pool.ConnPool;
-import org.apache.http.pool.PoolEntry;
+import org.apache.http.nio.NHttpConnection;
+import org.apache.http.nio.entity.NStringEntity;
+import org.apache.http.nio.protocol.HttpAsyncRequestExecutor.State;
 import org.apache.http.protocol.BasicHttpContext;
+import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpContext;
-import org.apache.http.protocol.HttpProcessor;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import org.mockito.ArgumentCaptor;
 import org.mockito.Mockito;
 
 public class TestHttpAsyncRequestExecutor {
 
-    private HttpProcessor httpProcessor;
-    private ConnectionReuseStrategy reuseStrategy;
-    private HttpParams params;
-    private HttpAsyncRequester requestExecutor;
-    private HttpContext exchangeContext;
+    private HttpAsyncRequestExecutor protocolHandler;
     private HttpContext connContext;
-    private HttpAsyncRequestProducer requestProducer;
-    private HttpAsyncResponseConsumer<Object> responseConsumer;
     private NHttpClientConnection conn;
-    private FutureCallback<Object> callback;
-    private ConnPool<HttpHost, PoolEntry<HttpHost, NHttpClientConnection>> connPool;
+    private HttpAsyncRequestExecutionHandler<?> exchangeHandler;
+    private HttpContext exchangeContext;
+    private ContentEncoder encoder;
+    private ContentDecoder decoder;
+    private ConnectionReuseStrategy reuseStrategy;
 
-    @SuppressWarnings("unchecked")
     @Before
     public void setUp() throws Exception {
-        this.httpProcessor = Mockito.mock(HttpProcessor.class);
-        this.reuseStrategy = Mockito.mock(ConnectionReuseStrategy.class);
-        this.params = new BasicHttpParams();
-        this.requestExecutor = new HttpAsyncRequester(
-                this.httpProcessor, this.reuseStrategy, this.params);
-        this.exchangeContext = new BasicHttpContext();
-        this.requestProducer = Mockito.mock(HttpAsyncRequestProducer.class);
-        this.responseConsumer = Mockito.mock(HttpAsyncResponseConsumer.class);
-        this.conn = Mockito.mock(NHttpClientConnection.class);
-        this.callback = Mockito.mock(FutureCallback.class);
+        this.protocolHandler = new HttpAsyncRequestExecutor();
         this.connContext = new BasicHttpContext();
-        this.connPool = Mockito.mock(ConnPool.class);
+        this.conn = Mockito.mock(NHttpClientConnection.class);
+        this.exchangeHandler = Mockito.mock(HttpAsyncRequestExecutionHandler.class);
+        this.exchangeContext = new BasicHttpContext();
+        this.encoder = Mockito.mock(ContentEncoder.class);
+        this.decoder = Mockito.mock(ContentDecoder.class);
+        this.reuseStrategy = Mockito.mock(ConnectionReuseStrategy.class);
 
         Mockito.when(this.conn.getContext()).thenReturn(this.connContext);
+        Mockito.when(this.exchangeHandler.getContext()).thenReturn(this.exchangeContext);
     }
 
     @After
@@ -88,251 +85,536 @@ public class TestHttpAsyncRequestExecuto
     }
 
     @Test
-    public void testInvalidExecution() throws Exception {
-        try {
-            this.requestExecutor.execute(
-                    null,
-                    this.responseConsumer,
-                    this.conn);
-            Assert.fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
-        }
-        try {
-            this.requestExecutor.execute(
-                    this.requestProducer,
-                    null,
-                    this.conn);
-            Assert.fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
-        }
-        try {
-            this.requestExecutor.execute(
-                    this.requestProducer,
-                    this.responseConsumer,
-                    (NHttpClientConnection) null);
-            Assert.fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
-        }
-        try {
-            this.requestExecutor.execute(
-                    this.requestProducer,
-                    this.responseConsumer,
-                    this.conn,
-                    null);
-            Assert.fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
-        }
-
-        try {
-            this.requestExecutor.execute(
-                    null,
-                    this.responseConsumer,
-                    this.connPool);
-            Assert.fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
-        }
-        try {
-            this.requestExecutor.execute(
-                    this.requestProducer,
-                    null,
-                    this.connPool);
-            Assert.fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
-        }
-        try {
-            this.requestExecutor.execute(
-                    this.requestProducer,
-                    this.responseConsumer,
-                    (ConnPool<HttpHost, PoolEntry<HttpHost, NHttpClientConnection>>) null);
-            Assert.fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
-        }
-        try {
-            this.requestExecutor.execute(
-                    this.requestProducer,
-                    this.responseConsumer,
-                    this.connPool,
-                    null);
-            Assert.fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
-        }
-    }
-
-    @Test
-    public void testSimpleExecute() throws Exception {
-        Future<Object> future = this.requestExecutor.execute(
-                this.requestProducer,
-                this.responseConsumer,
-                this.conn, this.exchangeContext, null);
-        Assert.assertNotNull(future);
-        Assert.assertNotNull(this.connContext.getAttribute(HttpAsyncRequestExecutor.HTTP_HANDLER));
+    public void testConnected() throws Exception {
+        HttpRequest request = new BasicHttpRequest("GET", "/");
+        Mockito.when(this.exchangeHandler.generateRequest()).thenReturn(request);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_HANDLER, this.exchangeHandler);
+
+        this.protocolHandler.connected(this.conn, null);
+
+        State state = (State) this.connContext.getAttribute(
+                HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE);
+        Assert.assertNotNull(state);
+        Assert.assertSame(this.exchangeHandler, state.getHandler());
+        Mockito.verify(this.exchangeHandler).generateRequest();
+        Assert.assertSame(request, state.getRequest());
+        Mockito.verify(this.conn).submitRequest(request);
+        Mockito.verify(this.exchangeHandler).requestCompleted(this.exchangeContext);
+        Assert.assertEquals(MessageState.COMPLETED, state.getRequestState());
+        Assert.assertEquals("request state: COMPLETED; request: GET / HTTP/1.1; " +
+                "response state: READY; response: ; valid: true;", state.toString());
+    }
+
+    @Test
+    public void testClosed() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        state.setRequestState(MessageState.COMPLETED);
+        state.setResponseState(MessageState.COMPLETED);
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+
+        this.protocolHandler.closed(this.conn);
+
+        Assert.assertNull(state.getHandler());
+        Assert.assertEquals(MessageState.READY, state.getRequestState());
+        Assert.assertEquals(MessageState.READY, state.getResponseState());
+        Mockito.verify(this.exchangeHandler).close();
+    }
+
+    @Test
+    public void testHttpExceptionHandling() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        state.setRequestState(MessageState.COMPLETED);
+        state.setResponseState(MessageState.COMPLETED);
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+
+        HttpException httpex = new HttpException();
+        this.protocolHandler.exception(this.conn, httpex);
+
+        Mockito.verify(this.exchangeHandler).failed(httpex);
+        Mockito.verify(this.exchangeHandler).close();
+        Mockito.verify(this.conn).shutdown();
+    }
+
+    @Test
+    public void testIOExceptionHandling() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        state.setRequestState(MessageState.COMPLETED);
+        state.setResponseState(MessageState.COMPLETED);
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+
+        IOException ioex = new IOException();
+        this.protocolHandler.exception(this.conn, ioex);
+
+        Mockito.verify(this.exchangeHandler).failed(ioex);
+        Mockito.verify(this.exchangeHandler).close();
+        Mockito.verify(this.conn).shutdown();
+    }
+
+    @Test
+    public void testBasicRequest() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+        HttpRequest request = new BasicHttpRequest("GET", "/");
+        Mockito.when(this.exchangeHandler.generateRequest()).thenReturn(request);
+
+        this.protocolHandler.requestReady(this.conn);
+
+        Mockito.verify(this.exchangeHandler).generateRequest();
+        Assert.assertSame(request, state.getRequest());
+        Mockito.verify(this.conn).submitRequest(request);
+        Mockito.verify(this.exchangeHandler).requestCompleted(this.exchangeContext);
+        Assert.assertEquals(MessageState.COMPLETED, state.getRequestState());
+    }
+
+    @Test
+    public void testEntityEnclosingRequestWithoutExpectContinue() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+        BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        request.setEntity(NStringEntity.create("stuff"));
+        Mockito.when(this.exchangeHandler.generateRequest()).thenReturn(request);
+
+        this.protocolHandler.requestReady(this.conn);
+
+        Mockito.verify(this.exchangeHandler).generateRequest();
+        Assert.assertSame(request, state.getRequest());
+        Mockito.verify(this.conn).submitRequest(request);
+        Mockito.verify(this.exchangeHandler, Mockito.never()).requestCompleted(this.exchangeContext);
+        Assert.assertEquals(MessageState.BODY_STREAM, state.getRequestState());
+    }
+
+    @Test
+    public void testEntityEnclosingRequestWithExpectContinue() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+        BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        request.setHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
+        Mockito.when(this.exchangeHandler.generateRequest()).thenReturn(request);
+        Mockito.when(this.conn.getSocketTimeout()).thenReturn(1000);
+
+        this.protocolHandler.requestReady(this.conn);
+
+        Mockito.verify(this.exchangeHandler).generateRequest();
+        Assert.assertSame(request, state.getRequest());
+        Mockito.verify(this.conn).submitRequest(request);
+        Mockito.verify(this.conn).setSocketTimeout(3000);
+        Assert.assertEquals(1000, state.getTimeout());
+        Mockito.verify(this.exchangeHandler, Mockito.never()).requestCompleted(this.exchangeContext);
+        Assert.assertEquals(MessageState.ACK_EXPECTED, state.getRequestState());
+    }
+
+    @Test
+    public void testRequestContentOutput() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+        Mockito.when(this.encoder.isCompleted()).thenReturn(false);
+
+        this.protocolHandler.outputReady(this.conn, this.encoder);
+
+        Mockito.verify(this.exchangeHandler).produceContent(this.encoder, this.conn);
+        Assert.assertEquals(MessageState.BODY_STREAM, state.getRequestState());
+    }
+
+    @Test
+    public void testRequestContentOutputCompleted() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+        Mockito.when(this.encoder.isCompleted()).thenReturn(true);
+
+        this.protocolHandler.outputReady(this.conn, this.encoder);
+
+        Mockito.verify(this.exchangeHandler).produceContent(this.encoder, this.conn);
+        Mockito.verify(this.exchangeHandler).requestCompleted(this.exchangeContext);
+        Assert.assertEquals(MessageState.COMPLETED, state.getRequestState());
+    }
+
+    @Test
+    public void testRequestContentContinueExpected() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        state.setRequestState(MessageState.ACK_EXPECTED);
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+
+        this.protocolHandler.outputReady(this.conn, this.encoder);
+
+        Mockito.verify(this.conn).suspendOutput();
+        Mockito.verify(this.exchangeHandler, Mockito.never()).produceContent(this.encoder, this.conn);
+        Assert.assertEquals(MessageState.ACK_EXPECTED, state.getRequestState());
+    }
+
+    @Test
+    public void testBasicResponse() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        HttpRequest request = new BasicHttpRequest("GET", "/");
+        state.setRequest(request);
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+        BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        Mockito.when(this.conn.getHttpResponse()).thenReturn(response);
+
+        this.protocolHandler.responseReceived(this.conn);
+
+        Assert.assertSame(response, state.getResponse());
+        Assert.assertEquals(MessageState.BODY_STREAM, state.getResponseState());
+    }
+
+    @Test
+    public void testResponseContinue() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        state.setRequestState(MessageState.ACK_EXPECTED);
+        state.setTimeout(1000);
+        BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        request.setEntity(NStringEntity.create("stuff"));
+        state.setRequest(request);
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+        BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 100, "Continue");
+        Mockito.when(this.conn.getHttpResponse()).thenReturn(response);
+
+        this.protocolHandler.responseReceived(this.conn);
+
+        Assert.assertNull(state.getResponse());
+        Assert.assertEquals(MessageState.ACK, state.getRequestState());
+        Assert.assertEquals(MessageState.READY, state.getResponseState());
+        Mockito.verify(this.conn).setSocketTimeout(1000);
         Mockito.verify(this.conn).requestOutput();
     }
 
-    @SuppressWarnings({ "rawtypes", "unchecked" })
     @Test
-    public void testPooledConnectionRequestFailed() throws Exception {
-        HttpHost host = new HttpHost("somehost");
-        Mockito.when(this.requestProducer.getTarget()).thenReturn(host);
-
-        Future<Object> future = this.requestExecutor.execute(
-                this.requestProducer,
-                this.responseConsumer,
-                this.connPool, this.exchangeContext, this.callback);
-        Assert.assertNotNull(future);
-        ArgumentCaptor<FutureCallback> argCaptor = ArgumentCaptor.forClass(FutureCallback.class);
-        Mockito.verify(this.connPool).lease(
-                Mockito.eq(host), Mockito.isNull(), argCaptor.capture());
-        ConnRequestCallback connRequestCallback = (ConnRequestCallback) argCaptor.getValue();
-
-        Exception oppsie = new Exception();
-        connRequestCallback.failed(oppsie);
-        Mockito.verify(this.responseConsumer).failed(oppsie);
-        Mockito.verify(this.callback).failed(oppsie);
-        Mockito.verify(this.responseConsumer).close();
-        Mockito.verify(this.requestProducer).close();
-    }
-
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    @Test
-    public void testPooledConnectionRequestCancelled() throws Exception {
-        HttpHost host = new HttpHost("somehost");
-        Mockito.when(this.requestProducer.getTarget()).thenReturn(host);
-
-        Future<Object> future = this.requestExecutor.execute(
-                this.requestProducer,
-                this.responseConsumer,
-                this.connPool, this.exchangeContext, this.callback);
-        Assert.assertNotNull(future);
-        ArgumentCaptor<FutureCallback> argCaptor = ArgumentCaptor.forClass(FutureCallback.class);
-        Mockito.verify(this.connPool).lease(
-                Mockito.eq(host), Mockito.isNull(), argCaptor.capture());
-        ConnRequestCallback connRequestCallback = (ConnRequestCallback) argCaptor.getValue();
-
-        connRequestCallback.cancelled();
-        Mockito.verify(this.responseConsumer).cancel();
-        Mockito.verify(this.callback).cancelled();
-        Mockito.verify(this.responseConsumer).close();
-        Mockito.verify(this.requestProducer).close();
-    }
-
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    @Test
-    public void testPooledConnectionAutoReleaseOnRequestCancel() throws Exception {
-        HttpHost host = new HttpHost("somehost");
-        Mockito.when(this.requestProducer.getTarget()).thenReturn(host);
-
-        Future<Object> future = this.requestExecutor.execute(
-                this.requestProducer,
-                this.responseConsumer,
-                this.connPool, this.exchangeContext, this.callback);
-        Assert.assertNotNull(future);
-        ArgumentCaptor<FutureCallback> argCaptor = ArgumentCaptor.forClass(FutureCallback.class);
-        Mockito.verify(this.connPool).lease(
-                Mockito.eq(host), Mockito.isNull(), argCaptor.capture());
-        ConnRequestCallback connRequestCallback = (ConnRequestCallback) argCaptor.getValue();
-
-        future.cancel(true);
-        BasicNIOPoolEntry entry = new BasicNIOPoolEntry("id", host, this.conn);
-        connRequestCallback.completed(entry);
-        Mockito.verify(this.connPool).release(entry, true);
+    public void testResponseContinueOutOfSequence() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        state.setRequestState(MessageState.COMPLETED);
+        BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        request.setEntity(NStringEntity.create("stuff"));
+        state.setRequest(request);
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+        BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 100, "Continue");
+        Mockito.when(this.conn.getHttpResponse()).thenReturn(response);
+
+        this.protocolHandler.responseReceived(this.conn);
+
+        Assert.assertNull(state.getResponse());
+        Assert.assertEquals(MessageState.COMPLETED, state.getRequestState());
         Mockito.verify(this.conn, Mockito.never()).requestOutput();
     }
 
+    @Test(expected=HttpException.class)
+    public void testResponseUnsupported1xx() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        state.setRequestState(MessageState.ACK_EXPECTED);
+        state.setTimeout(1000);
+        BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        request.setEntity(NStringEntity.create("stuff"));
+        state.setRequest(request);
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+        BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 111, "WTF?");
+        Mockito.when(this.conn.getHttpResponse()).thenReturn(response);
+
+        this.protocolHandler.responseReceived(this.conn);
+    }
 
-    @SuppressWarnings({ "rawtypes", "unchecked" })
     @Test
-    public void testPooledRequestExecutionSucceeded() throws Exception {
-        HttpHost host = new HttpHost("somehost");
-        Mockito.when(this.requestProducer.getTarget()).thenReturn(host);
-
-        Future<Object> future = this.requestExecutor.execute(
-                this.requestProducer,
-                this.responseConsumer,
-                this.connPool, this.exchangeContext, this.callback);
-        Assert.assertNotNull(future);
-        ArgumentCaptor<FutureCallback> argCaptor = ArgumentCaptor.forClass(FutureCallback.class);
-        Mockito.verify(this.connPool).lease(
-                Mockito.eq(host), Mockito.isNull(), argCaptor.capture());
-        ConnRequestCallback connRequestCallback = (ConnRequestCallback) argCaptor.getValue();
-
-        BasicNIOPoolEntry entry = new BasicNIOPoolEntry("id", host, this.conn);
-        connRequestCallback.completed(entry);
-        BasicAsyncRequestExecutionHandler exchangeHandler = (BasicAsyncRequestExecutionHandler) this.connContext.getAttribute(
-                HttpAsyncRequestExecutor.HTTP_HANDLER);
-        Assert.assertNotNull(exchangeHandler);
-        Mockito.verify(this.conn).requestOutput();
+    public void testResponseExpectationFailed() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        state.setRequestState(MessageState.ACK_EXPECTED);
+        state.setTimeout(1000);
+        BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        request.setEntity(NStringEntity.create("stuff"));
+        state.setRequest(request);
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+        BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 403, "Unauthorized");
+        Mockito.when(this.conn.getHttpResponse()).thenReturn(response);
+
+        this.protocolHandler.responseReceived(this.conn);
+
+        Assert.assertSame(response, state.getResponse());
+        Assert.assertEquals(MessageState.COMPLETED, state.getRequestState());
+        Assert.assertEquals(MessageState.BODY_STREAM, state.getResponseState());
+        Mockito.verify(this.conn).setSocketTimeout(1000);
+        Mockito.verify(this.conn).resetOutput();
+    }
 
-        Object result = new Object();
-        Mockito.when(this.responseConsumer.getResult()).thenReturn(result);
-        exchangeHandler.responseCompleted(this.exchangeContext);
-        Mockito.verify(this.callback).completed(result);
-        Mockito.verify(this.responseConsumer).close();
-        Mockito.verify(this.requestProducer).close();
-        Mockito.verify(this.connPool).release(entry, true);
-    }
-
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    @Test
-    public void testPooledRequestExecutionFailed() throws Exception {
-        HttpHost host = new HttpHost("somehost");
-        Mockito.when(this.requestProducer.getTarget()).thenReturn(host);
-
-        Future<Object> future = this.requestExecutor.execute(
-                this.requestProducer,
-                this.responseConsumer,
-                this.connPool, this.exchangeContext, this.callback);
-        Assert.assertNotNull(future);
-        ArgumentCaptor<FutureCallback> argCaptor = ArgumentCaptor.forClass(FutureCallback.class);
-        Mockito.verify(this.connPool).lease(
-                Mockito.eq(host), Mockito.isNull(), argCaptor.capture());
-        ConnRequestCallback connRequestCallback = (ConnRequestCallback) argCaptor.getValue();
-
-        BasicNIOPoolEntry entry = new BasicNIOPoolEntry("id", host, this.conn);
-        connRequestCallback.completed(entry);
-        BasicAsyncRequestExecutionHandler exchangeHandler = (BasicAsyncRequestExecutionHandler) this.connContext.getAttribute(
-                HttpAsyncRequestExecutor.HTTP_HANDLER);
-        Assert.assertNotNull(exchangeHandler);
-        Mockito.verify(this.conn).requestOutput();
+    @Test
+    public void testEarlyResponse() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        state.setRequestState(MessageState.BODY_STREAM);
+        state.setTimeout(1000);
+        BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        request.setEntity(NStringEntity.create("stuff"));
+        state.setRequest(request);
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+        BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 403, "Unauthorized");
+        Mockito.when(this.conn.getHttpResponse()).thenReturn(response);
+
+        this.protocolHandler.responseReceived(this.conn);
+
+        Assert.assertSame(response, state.getResponse());
+        Assert.assertEquals(MessageState.COMPLETED, state.getRequestState());
+        Assert.assertEquals(MessageState.BODY_STREAM, state.getResponseState());
+        Mockito.verify(this.conn).suspendOutput();
+        Mockito.verify(this.conn).resetOutput();
+        Assert.assertFalse(state.isValid());
+    }
 
-        Exception oppsie = new Exception();
-        exchangeHandler.failed(oppsie);
-        Mockito.verify(this.responseConsumer).failed(oppsie);
-        Mockito.verify(this.callback).failed(oppsie);
-        Mockito.verify(this.responseConsumer).close();
-        Mockito.verify(this.requestProducer).close();
-        Mockito.verify(this.connPool).release(entry, false);
-    }
-
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    @Test
-    public void testPooledRequestExecutionCancelled() throws Exception {
-        HttpHost host = new HttpHost("somehost");
-        Mockito.when(this.requestProducer.getTarget()).thenReturn(host);
-
-        Future<Object> future = this.requestExecutor.execute(
-                this.requestProducer,
-                this.responseConsumer,
-                this.connPool, this.exchangeContext, this.callback);
-        Assert.assertNotNull(future);
-        ArgumentCaptor<FutureCallback> argCaptor = ArgumentCaptor.forClass(FutureCallback.class);
-        Mockito.verify(this.connPool).lease(
-                Mockito.eq(host), Mockito.isNull(), argCaptor.capture());
-        ConnRequestCallback connRequestCallback = (ConnRequestCallback) argCaptor.getValue();
-
-        BasicNIOPoolEntry entry = new BasicNIOPoolEntry("id", host, this.conn);
-        connRequestCallback.completed(entry);
-        BasicAsyncRequestExecutionHandler exchangeHandler = (BasicAsyncRequestExecutionHandler) this.connContext.getAttribute(
-                HttpAsyncRequestExecutor.HTTP_HANDLER);
-        Assert.assertNotNull(exchangeHandler);
+    @Test
+    public void testResponseToHead() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        HttpRequest request = new BasicHttpRequest("HEAD", "/");
+        state.setRequest(request);
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+        BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        Mockito.when(this.conn.getHttpResponse()).thenReturn(response);
+        Mockito.when(this.reuseStrategy.keepAlive(response, this.exchangeContext)).thenReturn(true);
+        Mockito.when(this.exchangeHandler.getConnectionReuseStrategy()).thenReturn(this.reuseStrategy);
+
+        this.protocolHandler.responseReceived(this.conn);
+
+        Assert.assertEquals(MessageState.READY, state.getResponseState());
+        Assert.assertEquals(MessageState.READY, state.getRequestState());
+        Assert.assertNull(state.getRequest());
+        Assert.assertNull(state.getResponse());
+        Mockito.verify(this.exchangeHandler).responseReceived(response);
+        Mockito.verify(this.conn).resetInput();
+        Mockito.verify(this.conn, Mockito.never()).close();
+    }
+
+    @Test
+    public void testResponseToConnect() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        HttpRequest request = new BasicHttpRequest("Connect", "/");
+        state.setRequest(request);
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+        BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        Mockito.when(this.conn.getHttpResponse()).thenReturn(response);
+        Mockito.when(this.reuseStrategy.keepAlive(response, this.exchangeContext)).thenReturn(true);
+        Mockito.when(this.exchangeHandler.getConnectionReuseStrategy()).thenReturn(this.reuseStrategy);
+
+        this.protocolHandler.responseReceived(this.conn);
+
+        Assert.assertEquals(MessageState.READY, state.getResponseState());
+        Assert.assertEquals(MessageState.READY, state.getRequestState());
+        Assert.assertNull(state.getRequest());
+        Assert.assertNull(state.getResponse());
+        Mockito.verify(this.exchangeHandler).responseReceived(response);
+        Mockito.verify(this.conn).resetInput();
+        Mockito.verify(this.conn, Mockito.never()).close();
+    }
+
+    @Test
+    public void testResponseNotModified() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        HttpRequest request = new BasicHttpRequest("Connect", "/");
+        state.setRequest(request);
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+        BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
+                HttpStatus.SC_NOT_MODIFIED, "Not modified");
+        Mockito.when(this.conn.getHttpResponse()).thenReturn(response);
+        Mockito.when(this.reuseStrategy.keepAlive(response, this.exchangeContext)).thenReturn(true);
+        Mockito.when(this.exchangeHandler.getConnectionReuseStrategy()).thenReturn(this.reuseStrategy);
+
+        this.protocolHandler.responseReceived(this.conn);
+
+        Assert.assertEquals(MessageState.READY, state.getResponseState());
+        Assert.assertEquals(MessageState.READY, state.getRequestState());
+        Assert.assertNull(state.getRequest());
+        Assert.assertNull(state.getResponse());
+        Mockito.verify(this.exchangeHandler).responseReceived(response);
+        Mockito.verify(this.conn).resetInput();
+        Mockito.verify(this.conn, Mockito.never()).close();
+    }
+
+    @Test
+    public void testResponseContentInput() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+        Mockito.when(this.decoder.isCompleted()).thenReturn(false);
+
+        this.protocolHandler.inputReady(this.conn, this.decoder);
+
+        Mockito.verify(this.exchangeHandler).consumeContent(this.decoder, this.conn);
+        Assert.assertEquals(MessageState.BODY_STREAM, state.getResponseState());
+    }
+
+    @Test
+    public void testResponseContentOutputCompleted() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        HttpRequest request = new BasicHttpRequest("GET", "/");
+        state.setRequest(request);
+        BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        state.setResponse(response);
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+        Mockito.when(this.reuseStrategy.keepAlive(response, this.exchangeContext)).thenReturn(true);
+        Mockito.when(this.exchangeHandler.getConnectionReuseStrategy()).thenReturn(this.reuseStrategy);
+        Mockito.when(this.decoder.isCompleted()).thenReturn(true);
+
+        this.protocolHandler.inputReady(this.conn, this.decoder);
+
+        Assert.assertEquals(MessageState.READY, state.getRequestState());
+        Assert.assertEquals(MessageState.READY, state.getResponseState());
+        Mockito.verify(this.exchangeHandler).consumeContent(this.decoder, this.conn);
+        Mockito.verify(this.exchangeHandler).responseCompleted(this.exchangeContext);
+        Mockito.verify(this.conn, Mockito.never()).close();
+    }
+
+    @Test
+    public void testResponseInvalidState() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        HttpRequest request = new BasicHttpRequest("GET", "/");
+        state.setRequest(request);
+        BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        state.setResponse(response);
+        state.invalidate();
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+        Mockito.when(this.decoder.isCompleted()).thenReturn(true);
+
+        this.protocolHandler.inputReady(this.conn, this.decoder);
+
+        Assert.assertEquals(MessageState.READY, state.getRequestState());
+        Assert.assertEquals(MessageState.READY, state.getResponseState());
+        Mockito.verify(this.exchangeHandler).consumeContent(this.decoder, this.conn);
+        Mockito.verify(this.conn).close();
+        Mockito.verify(this.exchangeHandler, Mockito.never()).getConnectionReuseStrategy();
+    }
+
+    @Test
+    public void testResponseNoKeepAlive() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        HttpRequest request = new BasicHttpRequest("GET", "/");
+        state.setRequest(request);
+        BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        state.setResponse(response);
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+        Mockito.when(this.reuseStrategy.keepAlive(response, this.exchangeContext)).thenReturn(false);
+        Mockito.when(this.exchangeHandler.getConnectionReuseStrategy()).thenReturn(this.reuseStrategy);
+        Mockito.when(this.decoder.isCompleted()).thenReturn(true);
+
+        this.protocolHandler.inputReady(this.conn, this.decoder);
+
+        Assert.assertEquals(MessageState.READY, state.getRequestState());
+        Assert.assertEquals(MessageState.READY, state.getResponseState());
+        Mockito.verify(this.exchangeHandler).consumeContent(this.decoder, this.conn);
+        Mockito.verify(this.exchangeHandler).responseCompleted(this.exchangeContext);
+        Mockito.verify(this.conn).close();
+    }
+
+    @Test
+    public void testTimeoutNoHandler() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+
+        Mockito.when(this.conn.getStatus()).thenReturn(
+                NHttpConnection.ACTIVE, NHttpConnection.CLOSING);
+
+        this.protocolHandler.timeout(this.conn);
+
+        Mockito.verify(this.conn).close();
+        Mockito.verify(this.conn).setSocketTimeout(250);
+    }
+
+    @Test
+    public void testExpectContinueTimeout() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        state.setRequestState(MessageState.ACK_EXPECTED);
+        state.setTimeout(1000);
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+
+        this.protocolHandler.timeout(this.conn);
+
+        Assert.assertEquals(MessageState.BODY_STREAM, state.getRequestState());
+        Mockito.verify(this.conn).setSocketTimeout(1000);
         Mockito.verify(this.conn).requestOutput();
+    }
+
+    @Test
+    public void testTimeoutActiveConnection() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        state.setRequestState(MessageState.BODY_STREAM);
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+        Mockito.when(this.conn.getStatus()).thenReturn(NHttpConnection.ACTIVE, NHttpConnection.CLOSED);
+
+        this.protocolHandler.timeout(this.conn);
+
+        Assert.assertEquals(MessageState.BODY_STREAM, state.getRequestState());
+        Mockito.verify(this.exchangeHandler).failed(Mockito.any(SocketTimeoutException.class));
+        Mockito.verify(this.exchangeHandler).close();
+        Mockito.verify(this.conn).close();
+        Mockito.verify(this.conn, Mockito.never()).setSocketTimeout(Mockito.anyInt());
+    }
+
+    @Test
+    public void testTimeoutActiveConnectionBufferedData() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        state.setRequestState(MessageState.BODY_STREAM);
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+        Mockito.when(this.conn.getStatus()).thenReturn(NHttpConnection.ACTIVE, NHttpConnection.CLOSING);
+
+        this.protocolHandler.timeout(this.conn);
+
+        Assert.assertEquals(MessageState.BODY_STREAM, state.getRequestState());
+        Mockito.verify(this.exchangeHandler).failed(Mockito.any(SocketTimeoutException.class));
+        Mockito.verify(this.exchangeHandler).close();
+        Mockito.verify(this.conn).close();
+        Mockito.verify(this.conn).setSocketTimeout(250);
+    }
+
+    @Test
+    public void testTimeoutClosingConnection() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        state.setRequestState(MessageState.BODY_STREAM);
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+        Mockito.when(this.conn.getStatus()).thenReturn(NHttpConnection.CLOSING, NHttpConnection.CLOSED);
+
+        this.protocolHandler.timeout(this.conn);
+
+        Assert.assertEquals(MessageState.BODY_STREAM, state.getRequestState());
+        Mockito.verify(this.exchangeHandler).failed(Mockito.any(SocketTimeoutException.class));
+        Mockito.verify(this.exchangeHandler).close();
+        Mockito.verify(this.conn).shutdown();
+    }
 
-        exchangeHandler.cancel();
-        Mockito.verify(this.responseConsumer).cancel();
-        Mockito.verify(this.callback).cancelled();
-        Mockito.verify(this.responseConsumer).close();
-        Mockito.verify(this.requestProducer).close();
-        Mockito.verify(this.connPool).release(entry, false);
+    @Test
+    public void testExchangeDone() throws Exception {
+        State state = new HttpAsyncRequestExecutor.State();
+        HttpRequest request = new BasicHttpRequest("GET", "/");
+        state.setRequest(request);
+        BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        state.setResponse(response);
+        state.setHandler(this.exchangeHandler);
+        this.connContext.setAttribute(HttpAsyncRequestExecutor.HTTP_EXCHANGE_STATE, state);
+        Mockito.when(this.exchangeHandler.isDone()).thenReturn(true);
+
+        Assert.assertEquals("request state: READY; request: GET / HTTP/1.1; " +
+                "response state: READY; response: HTTP/1.1 200 OK; valid: true;",
+                state.toString());
+
+        this.protocolHandler.requestReady(this.conn);
+
+        Assert.assertEquals(MessageState.READY, state.getRequestState());
+        Assert.assertEquals(MessageState.READY, state.getResponseState());
+        Assert.assertNull(state.getHandler());
     }
 
 }

Copied: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequester.java (from r1225503, httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequester.java?p2=httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequester.java&p1=httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java&r1=1225503&r2=1225504&rev=1225504&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequester.java Thu Dec 29 12:09:56 2011
@@ -50,12 +50,12 @@ import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 import org.mockito.Mockito;
 
-public class TestHttpAsyncRequestExecutor {
+public class TestHttpAsyncRequester {
 
     private HttpProcessor httpProcessor;
     private ConnectionReuseStrategy reuseStrategy;
     private HttpParams params;
-    private HttpAsyncRequester requestExecutor;
+    private HttpAsyncRequester requester;
     private HttpContext exchangeContext;
     private HttpContext connContext;
     private HttpAsyncRequestProducer requestProducer;
@@ -70,7 +70,7 @@ public class TestHttpAsyncRequestExecuto
         this.httpProcessor = Mockito.mock(HttpProcessor.class);
         this.reuseStrategy = Mockito.mock(ConnectionReuseStrategy.class);
         this.params = new BasicHttpParams();
-        this.requestExecutor = new HttpAsyncRequester(
+        this.requester = new HttpAsyncRequester(
                 this.httpProcessor, this.reuseStrategy, this.params);
         this.exchangeContext = new BasicHttpContext();
         this.requestProducer = Mockito.mock(HttpAsyncRequestProducer.class);
@@ -90,7 +90,7 @@ public class TestHttpAsyncRequestExecuto
     @Test
     public void testInvalidExecution() throws Exception {
         try {
-            this.requestExecutor.execute(
+            this.requester.execute(
                     null,
                     this.responseConsumer,
                     this.conn);
@@ -98,7 +98,7 @@ public class TestHttpAsyncRequestExecuto
         } catch (IllegalArgumentException ex) {
         }
         try {
-            this.requestExecutor.execute(
+            this.requester.execute(
                     this.requestProducer,
                     null,
                     this.conn);
@@ -106,7 +106,7 @@ public class TestHttpAsyncRequestExecuto
         } catch (IllegalArgumentException ex) {
         }
         try {
-            this.requestExecutor.execute(
+            this.requester.execute(
                     this.requestProducer,
                     this.responseConsumer,
                     (NHttpClientConnection) null);
@@ -114,7 +114,7 @@ public class TestHttpAsyncRequestExecuto
         } catch (IllegalArgumentException ex) {
         }
         try {
-            this.requestExecutor.execute(
+            this.requester.execute(
                     this.requestProducer,
                     this.responseConsumer,
                     this.conn,
@@ -124,7 +124,7 @@ public class TestHttpAsyncRequestExecuto
         }
 
         try {
-            this.requestExecutor.execute(
+            this.requester.execute(
                     null,
                     this.responseConsumer,
                     this.connPool);
@@ -132,7 +132,7 @@ public class TestHttpAsyncRequestExecuto
         } catch (IllegalArgumentException ex) {
         }
         try {
-            this.requestExecutor.execute(
+            this.requester.execute(
                     this.requestProducer,
                     null,
                     this.connPool);
@@ -140,7 +140,7 @@ public class TestHttpAsyncRequestExecuto
         } catch (IllegalArgumentException ex) {
         }
         try {
-            this.requestExecutor.execute(
+            this.requester.execute(
                     this.requestProducer,
                     this.responseConsumer,
                     (ConnPool<HttpHost, PoolEntry<HttpHost, NHttpClientConnection>>) null);
@@ -148,7 +148,7 @@ public class TestHttpAsyncRequestExecuto
         } catch (IllegalArgumentException ex) {
         }
         try {
-            this.requestExecutor.execute(
+            this.requester.execute(
                     this.requestProducer,
                     this.responseConsumer,
                     this.connPool,
@@ -160,7 +160,7 @@ public class TestHttpAsyncRequestExecuto
 
     @Test
     public void testSimpleExecute() throws Exception {
-        Future<Object> future = this.requestExecutor.execute(
+        Future<Object> future = this.requester.execute(
                 this.requestProducer,
                 this.responseConsumer,
                 this.conn, this.exchangeContext, null);
@@ -175,7 +175,7 @@ public class TestHttpAsyncRequestExecuto
         HttpHost host = new HttpHost("somehost");
         Mockito.when(this.requestProducer.getTarget()).thenReturn(host);
 
-        Future<Object> future = this.requestExecutor.execute(
+        Future<Object> future = this.requester.execute(
                 this.requestProducer,
                 this.responseConsumer,
                 this.connPool, this.exchangeContext, this.callback);
@@ -199,7 +199,7 @@ public class TestHttpAsyncRequestExecuto
         HttpHost host = new HttpHost("somehost");
         Mockito.when(this.requestProducer.getTarget()).thenReturn(host);
 
-        Future<Object> future = this.requestExecutor.execute(
+        Future<Object> future = this.requester.execute(
                 this.requestProducer,
                 this.responseConsumer,
                 this.connPool, this.exchangeContext, this.callback);
@@ -222,7 +222,7 @@ public class TestHttpAsyncRequestExecuto
         HttpHost host = new HttpHost("somehost");
         Mockito.when(this.requestProducer.getTarget()).thenReturn(host);
 
-        Future<Object> future = this.requestExecutor.execute(
+        Future<Object> future = this.requester.execute(
                 this.requestProducer,
                 this.responseConsumer,
                 this.connPool, this.exchangeContext, this.callback);
@@ -246,7 +246,7 @@ public class TestHttpAsyncRequestExecuto
         HttpHost host = new HttpHost("somehost");
         Mockito.when(this.requestProducer.getTarget()).thenReturn(host);
 
-        Future<Object> future = this.requestExecutor.execute(
+        Future<Object> future = this.requester.execute(
                 this.requestProducer,
                 this.responseConsumer,
                 this.connPool, this.exchangeContext, this.callback);
@@ -278,7 +278,7 @@ public class TestHttpAsyncRequestExecuto
         HttpHost host = new HttpHost("somehost");
         Mockito.when(this.requestProducer.getTarget()).thenReturn(host);
 
-        Future<Object> future = this.requestExecutor.execute(
+        Future<Object> future = this.requester.execute(
                 this.requestProducer,
                 this.responseConsumer,
                 this.connPool, this.exchangeContext, this.callback);
@@ -310,7 +310,7 @@ public class TestHttpAsyncRequestExecuto
         HttpHost host = new HttpHost("somehost");
         Mockito.when(this.requestProducer.getTarget()).thenReturn(host);
 
-        Future<Object> future = this.requestExecutor.execute(
+        Future<Object> future = this.requester.execute(
                 this.requestProducer,
                 this.responseConsumer,
                 this.connPool, this.exchangeContext, this.callback);

Copied: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java (from r1225503, httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncServerProtocolHandler.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java?p2=httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java&p1=httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncServerProtocolHandler.java&r1=1225503&r2=1225504&rev=1225504&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncServerProtocolHandler.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncService.java Thu Dec 29 12:09:56 2011
@@ -63,7 +63,7 @@ import org.junit.Test;
 import org.mockito.ArgumentMatcher;
 import org.mockito.Mockito;
 
-public class TestHttpAsyncServerProtocolHandler {
+public class TestHttpAsyncService {
 
     private HttpAsyncRequestHandlerRegistry handlerResolver;
     private HttpAsyncService protocolHandler;

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

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

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



Mime
View raw message