hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1227872 - in /httpcomponents/httpcore/trunk: httpcore-nio/src/main/java/org/apache/http/nio/protocol/ httpcore-nio/src/test/java/org/apache/http/nio/protocol/ httpcore/src/main/java/org/apache/http/impl/io/
Date Thu, 05 Jan 2012 22:21:30 GMT
Author: olegk
Date: Thu Jan  5 22:21:30 2012
New Revision: 1227872

URL: http://svn.apache.org/viewvc?rev=1227872&view=rev
Log:
Moved HTTP message processing from individual request execution handlers to the client side
protocol handler

Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncRequestExecutionHandler.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutionHandler.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutor.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequester.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestExecutionHandler.java
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncRequestExecutor.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionOutputBuffer.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncRequestExecutionHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncRequestExecutionHandler.java?rev=1227872&r1=1227871&r2=1227872&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncRequestExecutionHandler.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/BasicAsyncRequestExecutionHandler.java
Thu Jan  5 22:21:30 2012
@@ -38,10 +38,8 @@ import org.apache.http.concurrent.BasicF
 import org.apache.http.nio.ContentDecoder;
 import org.apache.http.nio.ContentEncoder;
 import org.apache.http.nio.IOControl;
-import org.apache.http.nio.NHttpClientConnection;
 import org.apache.http.params.DefaultedHttpParams;
 import org.apache.http.params.HttpParams;
-import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpProcessor;
 
@@ -52,7 +50,6 @@ class BasicAsyncRequestExecutionHandler<
     private final HttpAsyncResponseConsumer<T> responseConsumer;
     private final HttpContext localContext;
     private final HttpProcessor httppocessor;
-    private final NHttpClientConnection conn;
     private final ConnectionReuseStrategy reuseStrategy;
     private final HttpParams params;
 
@@ -62,7 +59,6 @@ class BasicAsyncRequestExecutionHandler<
             final HttpAsyncResponseConsumer<T> responseConsumer,
             final HttpContext localContext,
             final HttpProcessor httppocessor,
-            final NHttpClientConnection conn,
             final ConnectionReuseStrategy reuseStrategy,
             final HttpParams params) {
         super();
@@ -81,9 +77,6 @@ class BasicAsyncRequestExecutionHandler<
         if (httppocessor == null) {
             throw new IllegalArgumentException("HTTP processor may not be null");
         }
-        if (conn == null) {
-            throw new IllegalArgumentException("HTTP connection may not be null");
-        }
         if (reuseStrategy == null) {
             throw new IllegalArgumentException("Connection reuse strategy may not be null");
         }
@@ -95,7 +88,6 @@ class BasicAsyncRequestExecutionHandler<
         this.responseConsumer = responseConsumer;
         this.localContext = localContext;
         this.httppocessor = httppocessor;
-        this.conn = conn;
         this.reuseStrategy = reuseStrategy;
         this.params = params;
     }
@@ -123,16 +115,8 @@ class BasicAsyncRequestExecutionHandler<
     }
 
     public HttpRequest generateRequest() throws IOException, HttpException {
-        HttpHost target = this.requestProducer.getTarget();
         HttpRequest request = this.requestProducer.generateRequest();
         request.setParams(new DefaultedHttpParams(request.getParams(), this.params));
-
-        this.localContext.setAttribute(ExecutionContext.HTTP_REQUEST, request);
-        this.localContext.setAttribute(ExecutionContext.HTTP_TARGET_HOST, target);
-        this.localContext.setAttribute(ExecutionContext.HTTP_CONNECTION, this.conn);
-
-        this.httppocessor.process(request, this.localContext);
-
         return request;
     }
 
@@ -157,8 +141,6 @@ class BasicAsyncRequestExecutionHandler<
 
     public void responseReceived(final HttpResponse response) throws IOException, HttpException
{
         response.setParams(new DefaultedHttpParams(response.getParams(), this.params));
-        this.localContext.setAttribute(ExecutionContext.HTTP_RESPONSE, response);
-        this.httppocessor.process(response, this.localContext);
         this.responseConsumer.responseReceived(response);
     }
 
@@ -220,6 +202,10 @@ class BasicAsyncRequestExecutionHandler<
         return this.localContext;
     }
 
+    public HttpProcessor getHttpProcessor() {
+        return this.httppocessor;
+    }
+
     public ConnectionReuseStrategy getConnectionReuseStrategy() {
         return this.reuseStrategy;
     }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutionHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutionHandler.java?rev=1227872&r1=1227871&r2=1227872&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutionHandler.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutionHandler.java
Thu Jan  5 22:21:30 2012
@@ -29,6 +29,7 @@ package org.apache.http.nio.protocol;
 
 import org.apache.http.ConnectionReuseStrategy;
 import org.apache.http.protocol.HttpContext;
+import org.apache.http.protocol.HttpProcessor;
 
 /**
  * <tt>HttpAsyncRequestExecutionHandler</tt> represents a callback interface
@@ -50,7 +51,15 @@ public interface HttpAsyncRequestExecuti
     HttpContext getContext();
 
     /**
-     * Returns {@link ConnectionReuseStrategy} implementation that can be used
+     * Returns {@link HttpProcessor} implementation to be used to process 
+     * HTTP request and response messages for protocol compliance.
+     *
+     * @return HTTP protocol processor.
+     */
+    HttpProcessor getHttpProcessor();
+    
+    /**
+     * Returns {@link ConnectionReuseStrategy} implementation to be used
      * to determine whether or not the underlying connection can be kept alive
      * after a particular HTTP request / response exchange.
      *

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutor.java?rev=1227872&r1=1227871&r2=1227872&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutor.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequestExecutor.java
Thu Jan  5 22:21:30 2012
@@ -46,6 +46,7 @@ import org.apache.http.nio.NHttpClientCo
 import org.apache.http.nio.NHttpClientEventHandler;
 import org.apache.http.nio.NHttpConnection;
 import org.apache.http.params.CoreProtocolPNames;
+import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpProcessor;
 
@@ -142,8 +143,16 @@ public class HttpAsyncRequestExecutor im
             if (handler == null) {
                 return;
             }
+
             HttpContext context = handler.getContext();
+            context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
+
             HttpRequest request = handler.generateRequest();
+            context.setAttribute(ExecutionContext.HTTP_REQUEST, request);
+            
+            HttpProcessor httppocessor = handler.getHttpProcessor();
+            httppocessor.process(request, context);
+            
             state.setRequest(request);
 
             conn.submitRequest(request);
@@ -222,7 +231,15 @@ public class HttpAsyncRequestExecutor im
                 state.setRequestState(MessageState.COMPLETED);
                 state.invalidate();
             }
+
             handler.responseReceived(response);
+            
+            HttpContext context = handler.getContext();
+            HttpProcessor httpprocessor = handler.getHttpProcessor();
+            
+            context.setAttribute(ExecutionContext.HTTP_RESPONSE, response);
+            httpprocessor.process(response, context);
+            
             state.setResponseState(MessageState.BODY_STREAM);
             if (!canResponseHaveBody(request, response)) {
                 conn.resetInput();

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequester.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequester.java?rev=1227872&r1=1227871&r2=1227872&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequester.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/protocol/HttpAsyncRequester.java
Thu Jan  5 22:21:30 2012
@@ -102,7 +102,7 @@ public class HttpAsyncRequester {
         BasicFuture<T> future = new BasicFuture<T>(callback);
         HttpAsyncRequestExecutionHandler<T> handler = new BasicAsyncRequestExecutionHandler<T>(
                 future, requestProducer, responseConsumer, context,
-                this.httppocessor, conn, this.reuseStrategy, this.params);
+                this.httppocessor, this.reuseStrategy, this.params);
         conn.getContext().setAttribute(HttpAsyncRequestExecutor.HTTP_HANDLER, handler);
         conn.requestOutput();
         return future;
@@ -247,7 +247,7 @@ public class HttpAsyncRequester {
                     this.requestFuture, result, this.connPool));
             HttpAsyncRequestExecutionHandler<T> handler = new BasicAsyncRequestExecutionHandler<T>(
                     execFuture, this.requestProducer, this.responseConsumer, this.context,
-                    httppocessor, conn, reuseStrategy, params);
+                    httppocessor, reuseStrategy, params);
             conn.getContext().setAttribute(HttpAsyncRequestExecutor.HTTP_HANDLER, handler);
             conn.requestOutput();
         }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestExecutionHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestExecutionHandler.java?rev=1227872&r1=1227871&r2=1227872&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestExecutionHandler.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestBasicAsyncRequestExecutionHandler.java
Thu Jan  5 22:21:30 2012
@@ -33,6 +33,7 @@ import junit.framework.Assert;
 
 import org.apache.http.ConnectionReuseStrategy;
 import org.apache.http.HttpHost;
+import org.apache.http.HttpRequest;
 import org.apache.http.HttpVersion;
 import org.apache.http.concurrent.BasicFuture;
 import org.apache.http.message.BasicHttpRequest;
@@ -43,7 +44,6 @@ import org.apache.http.nio.NHttpClientCo
 import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.HttpParams;
 import org.apache.http.protocol.BasicHttpContext;
-import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpProcessor;
 import org.junit.After;
@@ -73,7 +73,6 @@ public class TestBasicAsyncRequestExecut
         this.responseConsumer = Mockito.mock(HttpAsyncResponseConsumer.class);
         this.context = new BasicHttpContext();
         this.httpProcessor = Mockito.mock(HttpProcessor.class);
-        this.conn = Mockito.mock(NHttpClientConnection.class);
         this.reuseStrategy = Mockito.mock(ConnectionReuseStrategy.class);
         this.params = new BasicHttpParams();
         this.exchangeHandler = new BasicAsyncRequestExecutionHandler<Object>(
@@ -82,7 +81,6 @@ public class TestBasicAsyncRequestExecut
                 this.responseConsumer,
                 this.context,
                 this.httpProcessor,
-                this.conn,
                 this.reuseStrategy,
                 this.params);
         this.encoder = Mockito.mock(ContentEncoder.class);
@@ -102,7 +100,6 @@ public class TestBasicAsyncRequestExecut
                     this.responseConsumer,
                     this.context,
                     this.httpProcessor,
-                    this.conn,
                     this.reuseStrategy,
                     this.params);
             Assert.fail("IllegalArgumentException expected");
@@ -115,7 +112,6 @@ public class TestBasicAsyncRequestExecut
                     this.responseConsumer,
                     this.context,
                     this.httpProcessor,
-                    this.conn,
                     this.reuseStrategy,
                     this.params);
             Assert.fail("IllegalArgumentException expected");
@@ -128,7 +124,6 @@ public class TestBasicAsyncRequestExecut
                     null,
                     this.context,
                     this.httpProcessor,
-                    this.conn,
                     this.reuseStrategy,
                     this.params);
             Assert.fail("IllegalArgumentException expected");
@@ -141,7 +136,6 @@ public class TestBasicAsyncRequestExecut
                     this.responseConsumer,
                     null,
                     this.httpProcessor,
-                    this.conn,
                     this.reuseStrategy,
                     this.params);
             Assert.fail("IllegalArgumentException expected");
@@ -154,7 +148,6 @@ public class TestBasicAsyncRequestExecut
                     this.responseConsumer,
                     this.context,
                     null,
-                    this.conn,
                     this.reuseStrategy,
                     this.params);
             Assert.fail("IllegalArgumentException expected");
@@ -168,7 +161,6 @@ public class TestBasicAsyncRequestExecut
                     this.context,
                     this.httpProcessor,
                     null,
-                    this.reuseStrategy,
                     this.params);
             Assert.fail("IllegalArgumentException expected");
         } catch (IllegalArgumentException ex) {
@@ -180,20 +172,6 @@ public class TestBasicAsyncRequestExecut
                     this.responseConsumer,
                     this.context,
                     this.httpProcessor,
-                    this.conn,
-                    null,
-                    this.params);
-            Assert.fail("IllegalArgumentException expected");
-        } catch (IllegalArgumentException ex) {
-        }
-        try {
-            new BasicAsyncRequestExecutionHandler<Object>(
-                    this.future,
-                    this.requestProducer,
-                    this.responseConsumer,
-                    this.context,
-                    this.httpProcessor,
-                    this.conn,
                     this.reuseStrategy,
                     null);
             Assert.fail("IllegalArgumentException expected");
@@ -228,17 +206,14 @@ public class TestBasicAsyncRequestExecut
 
     @Test
     public void testGenerateRequest() throws Exception {
-        HttpHost target = new HttpHost("somehost");
-        Mockito.when(this.requestProducer.getTarget()).thenReturn(target);
         BasicHttpRequest request = new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);
         Mockito.when(this.requestProducer.generateRequest()).thenReturn(request);
 
-        this.exchangeHandler.generateRequest();
+        HttpRequest result = this.exchangeHandler.generateRequest();
 
-        Assert.assertSame(target, this.context.getAttribute(ExecutionContext.HTTP_TARGET_HOST));
-        Assert.assertSame(request, this.context.getAttribute(ExecutionContext.HTTP_REQUEST));
-        Assert.assertSame(this.conn, this.context.getAttribute(ExecutionContext.HTTP_CONNECTION));
-        Mockito.verify(this.httpProcessor).process(request, this.context);
+        Assert.assertSame(request, result);
+        
+        Mockito.verify(this.requestProducer).generateRequest();
     }
 
     @Test
@@ -273,8 +248,6 @@ public class TestBasicAsyncRequestExecut
 
         this.exchangeHandler.responseReceived(response);
 
-        Assert.assertSame(response, this.context.getAttribute(ExecutionContext.HTTP_RESPONSE));
-        Mockito.verify(this.httpProcessor).process(response, this.context);
         Mockito.verify(this.responseConsumer).responseReceived(response);
     }
 

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=1227872&r1=1227871&r2=1227872&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 Jan  5 22:21:30 2012
@@ -47,8 +47,10 @@ import org.apache.http.nio.NHttpConnecti
 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.ExecutionContext;
 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;
@@ -63,6 +65,7 @@ public class TestHttpAsyncRequestExecuto
     private HttpContext exchangeContext;
     private ContentEncoder encoder;
     private ContentDecoder decoder;
+    private HttpProcessor httpprocessor;
     private ConnectionReuseStrategy reuseStrategy;
 
     @Before
@@ -74,10 +77,13 @@ public class TestHttpAsyncRequestExecuto
         this.exchangeContext = new BasicHttpContext();
         this.encoder = Mockito.mock(ContentEncoder.class);
         this.decoder = Mockito.mock(ContentDecoder.class);
+        this.httpprocessor = Mockito.mock(HttpProcessor.class);
         this.reuseStrategy = Mockito.mock(ConnectionReuseStrategy.class);
 
         Mockito.when(this.conn.getContext()).thenReturn(this.connContext);
         Mockito.when(this.exchangeHandler.getContext()).thenReturn(this.exchangeContext);
+        Mockito.when(this.exchangeHandler.getHttpProcessor()).thenReturn(this.httpprocessor);
+        Mockito.when(this.exchangeHandler.getConnectionReuseStrategy()).thenReturn(this.reuseStrategy);
     }
 
     @After
@@ -165,6 +171,12 @@ public class TestHttpAsyncRequestExecuto
 
         Mockito.verify(this.exchangeHandler).generateRequest();
         Assert.assertSame(request, state.getRequest());
+        
+        Assert.assertSame(request, this.exchangeContext.getAttribute(ExecutionContext.HTTP_REQUEST));
+        Assert.assertSame(this.conn, this.exchangeContext.getAttribute(ExecutionContext.HTTP_CONNECTION));
+        Mockito.verify(this.httpprocessor).process(request, this.exchangeContext);
+        
+        
         Mockito.verify(this.conn).submitRequest(request);
         Mockito.verify(this.exchangeHandler).requestCompleted(this.exchangeContext);
         Assert.assertEquals(MessageState.COMPLETED, state.getRequestState());
@@ -264,6 +276,8 @@ public class TestHttpAsyncRequestExecuto
 
         Assert.assertSame(response, state.getResponse());
         Assert.assertEquals(MessageState.BODY_STREAM, state.getResponseState());
+        Assert.assertSame(response, this.exchangeContext.getAttribute(ExecutionContext.HTTP_RESPONSE));
+        Mockito.verify(this.httpprocessor).process(response, this.exchangeContext);
     }
 
     @Test
@@ -378,7 +392,6 @@ public class TestHttpAsyncRequestExecuto
         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);
 
@@ -401,7 +414,6 @@ public class TestHttpAsyncRequestExecuto
         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);
 
@@ -425,7 +437,6 @@ public class TestHttpAsyncRequestExecuto
                 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);
 
@@ -461,7 +472,6 @@ public class TestHttpAsyncRequestExecuto
         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);
@@ -504,7 +514,6 @@ public class TestHttpAsyncRequestExecuto
         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);

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java?rev=1227872&r1=1227871&r2=1227872&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java
Thu Jan  5 22:21:30 2012
@@ -358,8 +358,8 @@ public abstract class AbstractSessionInp
         }
         if (this.decoder == null) {
             this.decoder = this.charset.newDecoder();
-            this.decoder.onMalformedInput(onMalformedInputAction);
-            this.decoder.onUnmappableCharacter(onUnMappableInputAction);
+            this.decoder.onMalformedInput(this.onMalformedInputAction);
+            this.decoder.onUnmappableCharacter(this.onUnMappableInputAction);
         }
         if (this.cbuf == null) {
             this.cbuf = CharBuffer.allocate(1024);

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionOutputBuffer.java?rev=1227872&r1=1227871&r2=1227872&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
Thu Jan  5 22:21:30 2012
@@ -261,8 +261,8 @@ public abstract class AbstractSessionOut
         }
         if (this.encoder == null) {
             this.encoder = this.charset.newEncoder();
-            this.encoder.onMalformedInput(onMalformedInputAction);
-            this.encoder.onUnmappableCharacter(onUnMappableInputAction);
+            this.encoder.onMalformedInput(this.onMalformedInputAction);
+            this.encoder.onUnmappableCharacter(this.onUnMappableInputAction);
         }
         if (this.bbuf == null) {
             this.bbuf = ByteBuffer.allocate(1024);



Mime
View raw message