hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1641930 [3/3] - in /httpcomponents/httpcore/trunk: httpcore-ab/src/main/java/org/apache/http/benchmark/ httpcore-nio/src/examples/org/apache/http/examples/nio/ httpcore-nio/src/main/java/org/apache/http/impl/nio/ httpcore-nio/src/main/java...
Date Wed, 26 Nov 2014 20:30:09 GMT
Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestBHttpConnectionBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestBHttpConnectionBase.java?rev=1641930&r1=1641929&r2=1641930&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestBHttpConnectionBase.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestBHttpConnectionBase.java Wed Nov 26 20:30:08 2014
@@ -36,20 +36,14 @@ import java.net.SocketException;
 import java.net.SocketTimeoutException;
 
 import org.apache.http.Header;
-import org.apache.http.HeaderElements;
 import org.apache.http.HttpEntity;
-import org.apache.http.HttpHeaders;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpVersion;
 import org.apache.http.config.MessageConstraints;
-import org.apache.http.impl.entity.LaxContentLengthStrategy;
-import org.apache.http.impl.entity.StrictContentLengthStrategy;
+import org.apache.http.entity.ContentLengthStrategy;
 import org.apache.http.impl.io.ChunkedInputStream;
-import org.apache.http.impl.io.ChunkedOutputStream;
 import org.apache.http.impl.io.ContentLengthInputStream;
-import org.apache.http.impl.io.ContentLengthOutputStream;
 import org.apache.http.impl.io.IdentityInputStream;
-import org.apache.http.impl.io.IdentityOutputStream;
 import org.apache.http.message.BasicHttpResponse;
 import org.junit.Assert;
 import org.junit.Before;
@@ -68,11 +62,7 @@ public class TestBHttpConnectionBase {
     @Before
     public void setUp() throws Exception {
         MockitoAnnotations.initMocks(this);
-        conn = new BHttpConnectionBase(1024, 1024,
-            null, null,
-            MessageConstraints.DEFAULT,
-            LaxContentLengthStrategy.INSTANCE,
-            StrictContentLengthStrategy.INSTANCE);
+        conn = new BHttpConnectionBase(1024, 1024, null, null, MessageConstraints.DEFAULT);
     }
 
     @Test
@@ -118,7 +108,7 @@ public class TestBHttpConnectionBase {
 
         conn.bind(socket);
         conn.ensureOpen();
-        conn.getSessionOutputBuffer().write(0);
+        conn.outbuffer.write(0);
 
         Assert.assertTrue(conn.isOpen());
 
@@ -127,7 +117,7 @@ public class TestBHttpConnectionBase {
         Assert.assertFalse(conn.isOpen());
 
         Mockito.verify(outstream, Mockito.times(1)).write(
-                Mockito.<byte []>any(), Mockito.anyInt(), Mockito.anyInt());
+                Mockito.<byte[]>any(), Mockito.anyInt(), Mockito.anyInt());
         Mockito.verify(socket, Mockito.times(1)).shutdownInput();
         Mockito.verify(socket, Mockito.times(1)).shutdownOutput();
         Mockito.verify(socket, Mockito.times(1)).close();
@@ -135,7 +125,7 @@ public class TestBHttpConnectionBase {
         conn.close();
         Mockito.verify(socket, Mockito.times(1)).close();
         Mockito.verify(outstream, Mockito.times(1)).write(
-                Mockito.<byte []>any(), Mockito.anyInt(), Mockito.anyInt());
+                Mockito.<byte[]>any(), Mockito.anyInt(), Mockito.anyInt());
     }
 
     @Test
@@ -147,7 +137,7 @@ public class TestBHttpConnectionBase {
 
         conn.bind(socket);
         conn.ensureOpen();
-        conn.getSessionOutputBuffer().write(0);
+        conn.outbuffer.write(0);
 
         Assert.assertTrue(conn.isOpen());
 
@@ -169,12 +159,12 @@ public class TestBHttpConnectionBase {
     }
 
     @Test
-    public void testPrepareInputLengthDelimited() throws Exception {
+    public void testCreateEntityLengthDelimited() throws Exception {
         final HttpResponse message = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
         message.addHeader("Content-Length", "10");
         message.addHeader("Content-Type", "stuff");
         message.addHeader("Content-Encoding", "identity");
-        final HttpEntity entity = conn.prepareInput(message);
+        final HttpEntity entity = conn.createIncomingEntity(message, conn.inbuffer, 10);
         Assert.assertNotNull(entity);
         Assert.assertFalse(entity.isChunked());
         Assert.assertEquals(10, entity.getContentLength());
@@ -190,10 +180,10 @@ public class TestBHttpConnectionBase {
     }
 
     @Test
-    public void testPrepareInputChunked() throws Exception {
+    public void testCreateEntityInputChunked() throws Exception {
         final HttpResponse message = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
-        message.addHeader(HttpHeaders.TRANSFER_ENCODING, HeaderElements.CHUNKED_ENCODING);
-        final HttpEntity entity = conn.prepareInput(message);
+        final HttpEntity entity = conn.createIncomingEntity(message, conn.inbuffer,
+                ContentLengthStrategy.CHUNKED);
         Assert.assertNotNull(entity);
         Assert.assertTrue(entity.isChunked());
         Assert.assertEquals(-1, entity.getContentLength());
@@ -203,9 +193,10 @@ public class TestBHttpConnectionBase {
     }
 
     @Test
-    public void testPrepareInputIdentity() throws Exception {
+    public void testCreateEntityInputIdentity() throws Exception {
         final HttpResponse message = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
-        final HttpEntity entity = conn.prepareInput(message);
+        final HttpEntity entity = conn.createIncomingEntity(message, conn.inbuffer,
+                ContentLengthStrategy.IDENTITY);
         Assert.assertNotNull(entity);
         Assert.assertFalse(entity.isChunked());
         Assert.assertEquals(-1, entity.getContentLength());
@@ -215,29 +206,16 @@ public class TestBHttpConnectionBase {
     }
 
     @Test
-    public void testPrepareOutputLengthDelimited() throws Exception {
+    public void testCreateEntityInputUndefined() throws Exception {
         final HttpResponse message = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
-        message.addHeader("Content-Length", "10");
-        final OutputStream outstream = conn.prepareOutput(message);
-        Assert.assertNotNull(outstream);
-        Assert.assertTrue((outstream instanceof ContentLengthOutputStream));
-    }
-
-    @Test
-    public void testPrepareOutputChunked() throws Exception {
-        final HttpResponse message = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
-        message.addHeader(HttpHeaders.TRANSFER_ENCODING, HeaderElements.CHUNKED_ENCODING);
-        final OutputStream outstream = conn.prepareOutput(message);
-        Assert.assertNotNull(outstream);
-        Assert.assertTrue((outstream instanceof ChunkedOutputStream));
-    }
-
-    @Test
-    public void testPrepareOutputIdentity() throws Exception {
-        final HttpResponse message = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
-        final OutputStream outstream = conn.prepareOutput(message);
-        Assert.assertNotNull(outstream);
-        Assert.assertTrue((outstream instanceof IdentityOutputStream));
+        final HttpEntity entity = conn.createIncomingEntity(message, conn.inbuffer,
+                ContentLengthStrategy.UNDEFINED);
+        Assert.assertNotNull(entity);
+        Assert.assertFalse(entity.isChunked());
+        Assert.assertEquals(-1, entity.getContentLength());
+        final InputStream instream = entity.getContent();
+        Assert.assertNotNull(instream);
+        Assert.assertTrue((instream instanceof IdentityInputStream));
     }
 
     @Test
@@ -288,7 +266,7 @@ public class TestBHttpConnectionBase {
 
         conn.bind(socket);
         conn.ensureOpen();
-        conn.getSessionInputBuffer().read();
+        conn.inbuffer.read();
 
         Assert.assertTrue(conn.awaitInput(432));
 

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestDefaultBHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestDefaultBHttpClientConnection.java?rev=1641930&r1=1641929&r2=1641930&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestDefaultBHttpClientConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestDefaultBHttpClientConnection.java Wed Nov 26 20:30:08 2014
@@ -28,31 +28,33 @@ package org.apache.http.impl;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
 import java.net.Socket;
 
 import org.apache.http.Consts;
 import org.apache.http.HttpEntity;
-import org.apache.http.HttpEntityEnclosingRequest;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpVersion;
+import org.apache.http.ProtocolException;
 import org.apache.http.config.MessageConstraints;
 import org.apache.http.entity.ContentType;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.entity.LaxContentLengthStrategy;
 import org.apache.http.impl.entity.StrictContentLengthStrategy;
+import org.apache.http.impl.io.ChunkedInputStream;
+import org.apache.http.impl.io.ContentLengthInputStream;
 import org.apache.http.impl.io.DefaultHttpRequestWriterFactory;
 import org.apache.http.impl.io.DefaultHttpResponseParserFactory;
-import org.apache.http.message.BasicHttpEntityEnclosingRequest;
+import org.apache.http.impl.io.IdentityInputStream;
 import org.apache.http.message.BasicHttpRequest;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
 
-import org.junit.Assert;
-
 public class TestDefaultBHttpClientConnection {
 
     @Mock
@@ -79,7 +81,7 @@ public class TestDefaultBHttpClientConne
     }
 
     @Test
-    public void testReadRequestHead() throws Exception {
+    public void testReadResponseHead() throws Exception {
         final String s = "HTTP/1.1 200 OK\r\nUser-Agent: test\r\n\r\n";
         final ByteArrayInputStream instream = new ByteArrayInputStream(s.getBytes(Consts.ASCII));
         Mockito.when(socket.getInputStream()).thenReturn(instream);
@@ -97,8 +99,8 @@ public class TestDefaultBHttpClientConne
     }
 
     @Test
-    public void testReadRequestEntity() throws Exception {
-        final String s = "HTTP/1.1 200 OK\r\nUser-Agent: test\r\nContent-Length: 3\r\n\r\n123";
+    public void testReadResponseEntityWithContentLength() throws Exception {
+        final String s = "HTTP/1.1 200 OK\r\nServer: test\r\nContent-Length: 3\r\n\r\n123";
         final ByteArrayInputStream instream = new ByteArrayInputStream(s.getBytes(Consts.ASCII));
         Mockito.when(socket.getInputStream()).thenReturn(instream);
 
@@ -111,7 +113,7 @@ public class TestDefaultBHttpClientConne
         Assert.assertNotNull(response);
         Assert.assertEquals(HttpVersion.HTTP_1_1, response.getProtocolVersion());
         Assert.assertEquals(200, response.getStatusLine().getStatusCode());
-        Assert.assertTrue(response.containsHeader("User-Agent"));
+        Assert.assertTrue(response.containsHeader("Server"));
         Assert.assertEquals(1, conn.getMetrics().getResponseCount());
 
         conn.receiveResponseEntity(response);
@@ -120,10 +122,98 @@ public class TestDefaultBHttpClientConne
         Assert.assertNotNull(entity);
         Assert.assertEquals(3, entity.getContentLength());
         Assert.assertEquals(1, conn.getMetrics().getResponseCount());
+        final InputStream content = entity.getContent();
+        Assert.assertNotNull(content);
+        Assert.assertTrue(content instanceof ContentLengthInputStream);
+    }
+
+    @Test
+    public void testReadResponseEntityChunkCoded() throws Exception {
+        final String s = "HTTP/1.1 200 OK\r\nServer: test\r\nTransfer-Encoding: " +
+                "chunked\r\n\r\n3\r\n123\r\n0\r\n\r\n";
+        final ByteArrayInputStream instream = new ByteArrayInputStream(s.getBytes(Consts.ASCII));
+        Mockito.when(socket.getInputStream()).thenReturn(instream);
+
+        conn.bind(socket);
+
+        Assert.assertEquals(0, conn.getMetrics().getResponseCount());
+
+        final HttpResponse response = conn.receiveResponseHeader();
+
+        Assert.assertNotNull(response);
+        Assert.assertEquals(HttpVersion.HTTP_1_1, response.getProtocolVersion());
+        Assert.assertEquals(200, response.getStatusLine().getStatusCode());
+        Assert.assertTrue(response.containsHeader("Server"));
+        Assert.assertEquals(1, conn.getMetrics().getResponseCount());
+
+        conn.receiveResponseEntity(response);
+
+        final HttpEntity entity = response.getEntity();
+        Assert.assertNotNull(entity);
+        Assert.assertEquals(-1, entity.getContentLength());
+        Assert.assertEquals(true, entity.isChunked());
+        Assert.assertEquals(1, conn.getMetrics().getResponseCount());
+        final InputStream content = entity.getContent();
+        Assert.assertNotNull(content);
+        Assert.assertTrue(content instanceof ChunkedInputStream);
+    }
+
+    @Test
+    public void testReadResponseEntityIdentity() throws Exception {
+        final String s = "HTTP/1.1 200 OK\r\nServer: test\r\nTransfer-Encoding: identity\r\n\r\n123";
+        final ByteArrayInputStream instream = new ByteArrayInputStream(s.getBytes(Consts.ASCII));
+        Mockito.when(socket.getInputStream()).thenReturn(instream);
+
+        conn.bind(socket);
+
+        Assert.assertEquals(0, conn.getMetrics().getResponseCount());
+
+        final HttpResponse response = conn.receiveResponseHeader();
+
+        Assert.assertNotNull(response);
+        Assert.assertEquals(HttpVersion.HTTP_1_1, response.getProtocolVersion());
+        Assert.assertEquals(200, response.getStatusLine().getStatusCode());
+        Assert.assertTrue(response.containsHeader("Server"));
+        Assert.assertEquals(1, conn.getMetrics().getResponseCount());
+
+        conn.receiveResponseEntity(response);
+
+        final HttpEntity entity = response.getEntity();
+        Assert.assertNotNull(entity);
+        Assert.assertEquals(-1, entity.getContentLength());
+        Assert.assertEquals(false, entity.isChunked());
+        Assert.assertEquals(1, conn.getMetrics().getResponseCount());
+        final InputStream content = entity.getContent();
+        Assert.assertNotNull(content);
+        Assert.assertTrue(content instanceof IdentityInputStream);
     }
 
     @Test
-    public void testWriteResponseHead() throws Exception {
+    public void testReadResponseNoEntity() throws Exception {
+        final String s = "HTTP/1.1 200 OK\r\nServer: test\r\n\r\n";
+        final ByteArrayInputStream instream = new ByteArrayInputStream(s.getBytes(Consts.ASCII));
+        Mockito.when(socket.getInputStream()).thenReturn(instream);
+
+        conn.bind(socket);
+
+        Assert.assertEquals(0, conn.getMetrics().getResponseCount());
+
+        final HttpResponse response = conn.receiveResponseHeader();
+
+        Assert.assertNotNull(response);
+        Assert.assertEquals(HttpVersion.HTTP_1_1, response.getProtocolVersion());
+        Assert.assertEquals(200, response.getStatusLine().getStatusCode());
+        Assert.assertTrue(response.containsHeader("Server"));
+        Assert.assertEquals(1, conn.getMetrics().getResponseCount());
+
+        conn.receiveResponseEntity(response);
+
+        final HttpEntity entity = response.getEntity();
+        Assert.assertNull(entity);
+    }
+
+    @Test
+    public void testWriteRequestHead() throws Exception {
         final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
         Mockito.when(socket.getOutputStream()).thenReturn(outstream);
 
@@ -143,7 +233,7 @@ public class TestDefaultBHttpClientConne
     }
 
     @Test
-    public void testWriteResponseEntity() throws Exception {
+    public void testWriteRequestEntityWithContentLength() throws Exception {
         final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
         Mockito.when(socket.getOutputStream()).thenReturn(outstream);
 
@@ -151,8 +241,7 @@ public class TestDefaultBHttpClientConne
 
         Assert.assertEquals(0, conn.getMetrics().getRequestCount());
 
-        final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST",
-                "/stuff", HttpVersion.HTTP_1_1);
+        final HttpRequest request = new BasicHttpRequest("POST", "/stuff", HttpVersion.HTTP_1_1);
         request.addHeader("User-Agent", "test");
         request.addHeader("Content-Length", "3");
         request.setEntity(new StringEntity("123", ContentType.TEXT_PLAIN));
@@ -166,4 +255,67 @@ public class TestDefaultBHttpClientConne
         Assert.assertEquals("POST /stuff HTTP/1.1\r\nUser-Agent: test\r\nContent-Length: 3\r\n\r\n123", s);
     }
 
+    @Test
+    public void testWriteRequestEntityChunkCoded() throws Exception {
+        final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
+        Mockito.when(socket.getOutputStream()).thenReturn(outstream);
+
+        conn.bind(socket);
+
+        Assert.assertEquals(0, conn.getMetrics().getRequestCount());
+
+        final HttpRequest request = new BasicHttpRequest("POST", "/stuff", HttpVersion.HTTP_1_1);
+        request.addHeader("User-Agent", "test");
+        request.addHeader("Transfer-Encoding", "chunked");
+        request.setEntity(new StringEntity("123", ContentType.TEXT_PLAIN));
+
+        conn.sendRequestHeader(request);
+        conn.sendRequestEntity(request);
+        conn.flush();
+
+        Assert.assertEquals(1, conn.getMetrics().getRequestCount());
+        final String s = new String(outstream.toByteArray(), "ASCII");
+        Assert.assertEquals("POST /stuff HTTP/1.1\r\nUser-Agent: test\r\nTransfer-Encoding: " +
+                "chunked\r\n\r\n3\r\n123\r\n0\r\n\r\n", s);
+    }
+
+    @Test(expected = ProtocolException.class)
+    public void testWriteRequestEntityIdentity() throws Exception {
+        final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
+        Mockito.when(socket.getOutputStream()).thenReturn(outstream);
+
+        conn.bind(socket);
+
+        Assert.assertEquals(0, conn.getMetrics().getRequestCount());
+
+        final HttpRequest request = new BasicHttpRequest("POST", "/stuff", HttpVersion.HTTP_1_1);
+        request.addHeader("User-Agent", "test");
+        request.addHeader("Transfer-Encoding", "identity");
+        request.setEntity(new StringEntity("123", ContentType.TEXT_PLAIN));
+
+        conn.sendRequestHeader(request);
+        conn.sendRequestEntity(request);
+    }
+
+    @Test
+    public void testWriteRequestNoEntity() throws Exception {
+        final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
+        Mockito.when(socket.getOutputStream()).thenReturn(outstream);
+
+        conn.bind(socket);
+
+        Assert.assertEquals(0, conn.getMetrics().getRequestCount());
+
+        final HttpRequest request = new BasicHttpRequest("POST", "/stuff", HttpVersion.HTTP_1_1);
+        request.addHeader("User-Agent", "test");
+
+        conn.sendRequestHeader(request);
+        conn.sendRequestEntity(request);
+        conn.flush();
+
+        Assert.assertEquals(1, conn.getMetrics().getRequestCount());
+        final String s = new String(outstream.toByteArray(), "ASCII");
+        Assert.assertEquals("POST /stuff HTTP/1.1\r\nUser-Agent: test\r\n\r\n", s);
+    }
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestDefaultBHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestDefaultBHttpServerConnection.java?rev=1641930&r1=1641929&r2=1641930&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestDefaultBHttpServerConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/TestDefaultBHttpServerConnection.java Wed Nov 26 20:30:08 2014
@@ -28,30 +28,32 @@ package org.apache.http.impl;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
 import java.net.Socket;
 
 import org.apache.http.Consts;
 import org.apache.http.HttpEntity;
-import org.apache.http.HttpEntityEnclosingRequest;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpVersion;
+import org.apache.http.ProtocolException;
 import org.apache.http.config.MessageConstraints;
 import org.apache.http.entity.ContentType;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.entity.LaxContentLengthStrategy;
 import org.apache.http.impl.entity.StrictContentLengthStrategy;
+import org.apache.http.impl.io.ChunkedInputStream;
+import org.apache.http.impl.io.ContentLengthInputStream;
 import org.apache.http.impl.io.DefaultHttpRequestParserFactory;
 import org.apache.http.impl.io.DefaultHttpResponseWriterFactory;
 import org.apache.http.message.BasicHttpResponse;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
 
-import org.junit.Assert;
-
 public class TestDefaultBHttpServerConnection {
 
     @Mock
@@ -97,7 +99,7 @@ public class TestDefaultBHttpServerConne
     }
 
     @Test
-    public void testReadRequestEntity() throws Exception {
+    public void testReadRequestEntityWithContentLength() throws Exception {
         final String s = "POST / HTTP/1.1\r\nUser-Agent: test\r\nContent-Length: 3\r\n\r\n123";
         final ByteArrayInputStream instream = new ByteArrayInputStream(s.getBytes(Consts.ASCII));
         Mockito.when(socket.getInputStream()).thenReturn(instream);
@@ -106,7 +108,7 @@ public class TestDefaultBHttpServerConne
 
         Assert.assertEquals(0, conn.getMetrics().getRequestCount());
 
-        final HttpEntityEnclosingRequest request = (HttpEntityEnclosingRequest) conn.receiveRequestHeader();
+        final HttpRequest request = conn.receiveRequestHeader();
 
         Assert.assertNotNull(request);
         Assert.assertEquals(HttpVersion.HTTP_1_1, request.getProtocolVersion());
@@ -122,6 +124,92 @@ public class TestDefaultBHttpServerConne
         Assert.assertNotNull(entity);
         Assert.assertEquals(3, entity.getContentLength());
         Assert.assertEquals(1, conn.getMetrics().getRequestCount());
+        final InputStream content = entity.getContent();
+        Assert.assertNotNull(content);
+        Assert.assertTrue(content instanceof ContentLengthInputStream);
+    }
+
+    @Test
+    public void testReadRequestEntityChunckCoded() throws Exception {
+        final String s = "POST /stuff HTTP/1.1\r\nUser-Agent: test\r\nTransfer-Encoding: " +
+                "chunked\r\n\r\n3\r\n123\r\n0\r\n\r\n";
+        final ByteArrayInputStream instream = new ByteArrayInputStream(s.getBytes(Consts.ASCII));
+        Mockito.when(socket.getInputStream()).thenReturn(instream);
+
+        conn.bind(socket);
+
+        Assert.assertEquals(0, conn.getMetrics().getRequestCount());
+
+        final HttpRequest request = conn.receiveRequestHeader();
+
+        Assert.assertNotNull(request);
+        Assert.assertEquals(HttpVersion.HTTP_1_1, request.getProtocolVersion());
+        Assert.assertEquals("/stuff", request.getRequestLine().getUri());
+        Assert.assertEquals("POST", request.getRequestLine().getMethod());
+        Assert.assertTrue(request.containsHeader("User-Agent"));
+        Assert.assertNull(request.getEntity());
+        Assert.assertEquals(1, conn.getMetrics().getRequestCount());
+
+        conn.receiveRequestEntity(request);
+
+        final HttpEntity entity = request.getEntity();
+        Assert.assertNotNull(entity);
+        Assert.assertEquals(-1, entity.getContentLength());
+        Assert.assertEquals(true, entity.isChunked());
+        Assert.assertEquals(1, conn.getMetrics().getRequestCount());
+        final InputStream content = entity.getContent();
+        Assert.assertNotNull(content);
+        Assert.assertTrue(content instanceof ChunkedInputStream);
+    }
+
+    @Test(expected = ProtocolException.class)
+    public void testReadRequestEntityIdentity() throws Exception {
+        final String s = "POST /stuff HTTP/1.1\r\nUser-Agent: test\r\nTransfer-Encoding: " +
+                "identity\r\n\r\n123";
+        final ByteArrayInputStream instream = new ByteArrayInputStream(s.getBytes(Consts.ASCII));
+        Mockito.when(socket.getInputStream()).thenReturn(instream);
+
+        conn.bind(socket);
+
+        Assert.assertEquals(0, conn.getMetrics().getRequestCount());
+
+        final HttpRequest request = conn.receiveRequestHeader();
+
+        Assert.assertNotNull(request);
+        Assert.assertEquals(HttpVersion.HTTP_1_1, request.getProtocolVersion());
+        Assert.assertEquals("/stuff", request.getRequestLine().getUri());
+        Assert.assertEquals("POST", request.getRequestLine().getMethod());
+        Assert.assertTrue(request.containsHeader("User-Agent"));
+        Assert.assertNull(request.getEntity());
+        Assert.assertEquals(1, conn.getMetrics().getRequestCount());
+
+        conn.receiveRequestEntity(request);
+    }
+
+    @Test
+    public void testReadRequestNoEntity() throws Exception {
+        final String s = "POST /stuff HTTP/1.1\r\nUser-Agent: test\r\n\r\n";
+        final ByteArrayInputStream instream = new ByteArrayInputStream(s.getBytes(Consts.ASCII));
+        Mockito.when(socket.getInputStream()).thenReturn(instream);
+
+        conn.bind(socket);
+
+        Assert.assertEquals(0, conn.getMetrics().getRequestCount());
+
+        final HttpRequest request = conn.receiveRequestHeader();
+
+        Assert.assertNotNull(request);
+        Assert.assertEquals(HttpVersion.HTTP_1_1, request.getProtocolVersion());
+        Assert.assertEquals("/stuff", request.getRequestLine().getUri());
+        Assert.assertEquals("POST", request.getRequestLine().getMethod());
+        Assert.assertTrue(request.containsHeader("User-Agent"));
+        Assert.assertNull(request.getEntity());
+        Assert.assertEquals(1, conn.getMetrics().getRequestCount());
+
+        conn.receiveRequestEntity(request);
+
+        final HttpEntity entity = request.getEntity();
+        Assert.assertNull(entity);
     }
 
     @Test
@@ -164,7 +252,7 @@ public class TestDefaultBHttpServerConne
     }
 
     @Test
-    public void testWriteResponseEntity() throws Exception {
+    public void testWriteResponseEntityWithContentLength() throws Exception {
         final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
         Mockito.when(socket.getOutputStream()).thenReturn(outstream);
 
@@ -173,7 +261,7 @@ public class TestDefaultBHttpServerConne
         Assert.assertEquals(0, conn.getMetrics().getResponseCount());
 
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
-        response.addHeader("User-Agent", "test");
+        response.addHeader("Server", "test");
         response.addHeader("Content-Length", "3");
         response.setEntity(new StringEntity("123", ContentType.TEXT_PLAIN));
 
@@ -183,7 +271,75 @@ public class TestDefaultBHttpServerConne
 
         Assert.assertEquals(1, conn.getMetrics().getResponseCount());
         final String s = new String(outstream.toByteArray(), "ASCII");
-        Assert.assertEquals("HTTP/1.1 200 OK\r\nUser-Agent: test\r\nContent-Length: 3\r\n\r\n123", s);
+        Assert.assertEquals("HTTP/1.1 200 OK\r\nServer: test\r\nContent-Length: 3\r\n\r\n123", s);
+    }
+
+    @Test
+    public void testWriteResponseEntityChunkCoded() throws Exception {
+        final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
+        Mockito.when(socket.getOutputStream()).thenReturn(outstream);
+
+        conn.bind(socket);
+
+        Assert.assertEquals(0, conn.getMetrics().getResponseCount());
+
+        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        response.addHeader("Server", "test");
+        response.addHeader("Transfer-Encoding", "chunked");
+        response.setEntity(new StringEntity("123", ContentType.TEXT_PLAIN));
+
+        conn.sendResponseHeader(response);
+        conn.sendResponseEntity(response);
+        conn.flush();
+
+        Assert.assertEquals(1, conn.getMetrics().getResponseCount());
+        final String s = new String(outstream.toByteArray(), "ASCII");
+        Assert.assertEquals("HTTP/1.1 200 OK\r\nServer: test\r\nTransfer-Encoding: " +
+                "chunked\r\n\r\n3\r\n123\r\n0\r\n\r\n", s);
+    }
+
+    @Test
+    public void testWriteResponseEntityIdentity() throws Exception {
+        final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
+        Mockito.when(socket.getOutputStream()).thenReturn(outstream);
+
+        conn.bind(socket);
+
+        Assert.assertEquals(0, conn.getMetrics().getResponseCount());
+
+        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        response.addHeader("Server", "test");
+        response.addHeader("Transfer-Encoding", "identity");
+        response.setEntity(new StringEntity("123", ContentType.TEXT_PLAIN));
+
+        conn.sendResponseHeader(response);
+        conn.sendResponseEntity(response);
+        conn.flush();
+
+        Assert.assertEquals(1, conn.getMetrics().getResponseCount());
+        final String s = new String(outstream.toByteArray(), "ASCII");
+        Assert.assertEquals("HTTP/1.1 200 OK\r\nServer: test\r\nTransfer-Encoding: identity\r\n\r\n123", s);
+    }
+
+    @Test
+    public void testWriteResponseNoEntity() throws Exception {
+        final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
+        Mockito.when(socket.getOutputStream()).thenReturn(outstream);
+
+        conn.bind(socket);
+
+        Assert.assertEquals(0, conn.getMetrics().getResponseCount());
+
+        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        response.addHeader("Server", "test");
+
+        conn.sendResponseHeader(response);
+        conn.sendResponseEntity(response);
+        conn.flush();
+
+        Assert.assertEquals(1, conn.getMetrics().getResponseCount());
+        final String s = new String(outstream.toByteArray(), "ASCII");
+        Assert.assertEquals("HTTP/1.1 200 OK\r\nServer: test\r\n\r\n", s);
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/entity/TestLaxContentLengthStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/entity/TestLaxContentLengthStrategy.java?rev=1641930&r1=1641929&r2=1641930&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/entity/TestLaxContentLengthStrategy.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/entity/TestLaxContentLengthStrategy.java Wed Nov 26 20:30:08 2014
@@ -28,6 +28,7 @@
 package org.apache.http.impl.entity;
 
 import org.apache.http.HttpMessage;
+import org.apache.http.ProtocolException;
 import org.apache.http.entity.ContentLengthStrategy;
 import org.junit.Assert;
 import org.junit.Test;
@@ -40,7 +41,7 @@ public class TestLaxContentLengthStrateg
         final HttpMessage message = new DummyHttpMessage();
 
         message.addHeader("Content-Type", "unknown");
-        message.addHeader("Transfer-Encoding", "identity, chunked");
+        message.addHeader("Transfer-Encoding", "chunked");
         message.addHeader("Content-Length", "plain wrong");
         Assert.assertEquals(ContentLengthStrategy.CHUNKED, lenStrategy.determineLength(message));
     }
@@ -56,7 +57,7 @@ public class TestLaxContentLengthStrateg
         Assert.assertEquals(ContentLengthStrategy.IDENTITY, lenStrategy.determineLength(message));
     }
 
-    @Test
+    @Test(expected=ProtocolException.class)
     public void testEntityWithUnsupportedTransferEncoding() throws Exception {
         final ContentLengthStrategy lenStrategy = new LaxContentLengthStrategy();
         final HttpMessage message = new DummyHttpMessage();
@@ -64,10 +65,10 @@ public class TestLaxContentLengthStrateg
         message.addHeader("Content-Type", "unknown");
         message.addHeader("Transfer-Encoding", "whatever; param=value, chunked");
         message.addHeader("Content-Length", "plain wrong");
-        Assert.assertEquals(ContentLengthStrategy.CHUNKED, lenStrategy.determineLength(message));
+        lenStrategy.determineLength(message);
     }
 
-    @Test
+    @Test(expected=ProtocolException.class)
     public void testChunkedTransferEncodingMustBeLast() throws Exception {
         final ContentLengthStrategy lenStrategy = new LaxContentLengthStrategy();
         final HttpMessage message = new DummyHttpMessage();
@@ -75,7 +76,7 @@ public class TestLaxContentLengthStrateg
         message.addHeader("Content-Type", "unknown");
         message.addHeader("Transfer-Encoding", "chunked, identity");
         message.addHeader("Content-Length", "plain wrong");
-        Assert.assertEquals(ContentLengthStrategy.IDENTITY, lenStrategy.determineLength(message));
+        lenStrategy.determineLength(message);
     }
 
     @Test
@@ -112,7 +113,7 @@ public class TestLaxContentLengthStrateg
         Assert.assertEquals(1, lenStrategy.determineLength(message));
     }
 
-    @Test
+    @Test(expected=ProtocolException.class)
     public void testEntityWithMultipleContentLengthAllWrong() throws Exception {
         final ContentLengthStrategy lenStrategy = new LaxContentLengthStrategy();
         final HttpMessage message = new DummyHttpMessage();
@@ -120,17 +121,17 @@ public class TestLaxContentLengthStrateg
         message.addHeader("Content-Type", "unknown");
         message.addHeader("Content-Length", "yyy");
         message.addHeader("Content-Length", "xxx");
-        Assert.assertEquals(ContentLengthStrategy.IDENTITY, lenStrategy.determineLength(message));
+        lenStrategy.determineLength(message);
     }
 
-    @Test
+    @Test(expected=ProtocolException.class)
     public void testEntityWithInvalidContentLength() throws Exception {
         final ContentLengthStrategy lenStrategy = new LaxContentLengthStrategy();
         final HttpMessage message = new DummyHttpMessage();
 
         message.addHeader("Content-Type", "unknown");
         message.addHeader("Content-Length", "xxx");
-        Assert.assertEquals(ContentLengthStrategy.IDENTITY, lenStrategy.determineLength(message));
+        lenStrategy.determineLength(message);
     }
 
     @Test
@@ -139,7 +140,7 @@ public class TestLaxContentLengthStrateg
         final HttpMessage message = new DummyHttpMessage();
 
         // lenient mode
-        Assert.assertEquals(ContentLengthStrategy.IDENTITY, lenStrategy.determineLength(message));
+        Assert.assertEquals(ContentLengthStrategy.UNDEFINED, lenStrategy.determineLength(message));
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/entity/TestStrictContentLengthStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/entity/TestStrictContentLengthStrategy.java?rev=1641930&r1=1641929&r2=1641930&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/entity/TestStrictContentLengthStrategy.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/entity/TestStrictContentLengthStrategy.java Wed Nov 26 20:30:08 2014
@@ -28,7 +28,6 @@
 package org.apache.http.impl.entity;
 
 import org.apache.http.HttpMessage;
-import org.apache.http.HttpVersion;
 import org.apache.http.ProtocolException;
 import org.apache.http.entity.ContentLengthStrategy;
 import org.junit.Assert;
@@ -62,14 +61,6 @@ public class TestStrictContentLengthStra
         lenStrategy.determineLength(message);
     }
 
-    @Test(expected=ProtocolException.class)
-    public void testEntityWithInvalidChunkEncodingAndHTTP10() throws Exception {
-        final ContentLengthStrategy lenStrategy = new StrictContentLengthStrategy();
-        final HttpMessage message = new DummyHttpMessage(HttpVersion.HTTP_1_0);
-        message.addHeader("Transfer-Encoding", "chunked");
-        lenStrategy.determineLength(message);
-    }
-
     @Test
     public void testEntityWithContentLength() throws Exception {
         final ContentLengthStrategy lenStrategy = new StrictContentLengthStrategy();
@@ -98,7 +89,7 @@ public class TestStrictContentLengthStra
     public void testEntityNoContentDelimiter() throws Exception {
         final ContentLengthStrategy lenStrategy = new StrictContentLengthStrategy();
         final HttpMessage message = new DummyHttpMessage();
-        Assert.assertEquals(ContentLengthStrategy.IDENTITY, lenStrategy.determineLength(message));
+        Assert.assertEquals(ContentLengthStrategy.UNDEFINED, lenStrategy.determineLength(message));
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/integration/TestSyncHttp.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/integration/TestSyncHttp.java?rev=1641930&r1=1641929&r2=1641930&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/integration/TestSyncHttp.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/integration/TestSyncHttp.java Wed Nov 26 20:30:08 2014
@@ -41,7 +41,6 @@ import org.apache.http.Consts;
 import org.apache.http.Header;
 import org.apache.http.HttpConnectionMetrics;
 import org.apache.http.HttpEntity;
-import org.apache.http.HttpEntityEnclosingRequest;
 import org.apache.http.HttpException;
 import org.apache.http.HttpHeaders;
 import org.apache.http.HttpHost;
@@ -55,7 +54,6 @@ import org.apache.http.entity.ByteArrayE
 import org.apache.http.entity.ContentType;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.DefaultBHttpClientConnection;
-import org.apache.http.message.BasicHttpEntityEnclosingRequest;
 import org.apache.http.message.BasicHttpRequest;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpExpectationVerifier;
@@ -202,16 +200,13 @@ public class TestSyncHttp {
                     final HttpResponse response,
                     final HttpContext context) throws HttpException, IOException {
 
-                if (request instanceof HttpEntityEnclosingRequest) {
-                    final HttpEntity incoming = ((HttpEntityEnclosingRequest) request).getEntity();
+                final HttpEntity incoming = request.getEntity();
+                if (incoming != null) {
                     final byte[] data = EntityUtils.toByteArray(incoming);
 
                     final ByteArrayEntity outgoing = new ByteArrayEntity(data);
                     outgoing.setChunked(false);
                     response.setEntity(outgoing);
-                } else {
-                    final StringEntity outgoing = new StringEntity("No content");
-                    response.setEntity(outgoing);
                 }
             }
 
@@ -228,7 +223,7 @@ public class TestSyncHttp {
                     client.connect(host, conn);
                 }
 
-                final BasicHttpEntityEnclosingRequest post = new BasicHttpEntityEnclosingRequest("POST", "/");
+                final BasicHttpRequest post = new BasicHttpRequest("POST", "/");
                 final byte[] data = testData.get(r);
                 final ByteArrayEntity outgoing = new ByteArrayEntity(data);
                 post.setEntity(outgoing);
@@ -285,16 +280,12 @@ public class TestSyncHttp {
                     final HttpResponse response,
                     final HttpContext context) throws HttpException, IOException {
 
-                if (request instanceof HttpEntityEnclosingRequest) {
-                    final HttpEntity incoming = ((HttpEntityEnclosingRequest) request).getEntity();
-                    final byte[] data = EntityUtils.toByteArray(incoming);
-
+                final HttpEntity entity = request.getEntity();
+                if (entity != null) {
+                    final byte[] data = EntityUtils.toByteArray(entity);
                     final ByteArrayEntity outgoing = new ByteArrayEntity(data);
                     outgoing.setChunked(true);
                     response.setEntity(outgoing);
-                } else {
-                    final StringEntity outgoing = new StringEntity("No content");
-                    response.setEntity(outgoing);
                 }
             }
 
@@ -311,7 +302,7 @@ public class TestSyncHttp {
                     client.connect(host, conn);
                 }
 
-                final BasicHttpEntityEnclosingRequest post = new BasicHttpEntityEnclosingRequest("POST", "/");
+                final BasicHttpRequest post = new BasicHttpRequest("POST", "/");
                 final byte[] data = testData.get(r);
                 final ByteArrayEntity outgoing = new ByteArrayEntity(data);
                 outgoing.setChunked(true);
@@ -367,16 +358,13 @@ public class TestSyncHttp {
                     final HttpResponse response,
                     final HttpContext context) throws HttpException, IOException {
 
-                if (request instanceof HttpEntityEnclosingRequest) {
-                    final HttpEntity incoming = ((HttpEntityEnclosingRequest) request).getEntity();
+                final HttpEntity incoming = request.getEntity();
+                if (incoming != null) {
                     final byte[] data = EntityUtils.toByteArray(incoming);
 
                     final ByteArrayEntity outgoing = new ByteArrayEntity(data);
                     outgoing.setChunked(false);
                     response.setEntity(outgoing);
-                } else {
-                    final StringEntity outgoing = new StringEntity("No content");
-                    response.setEntity(outgoing);
                 }
             }
 
@@ -394,7 +382,7 @@ public class TestSyncHttp {
                 }
 
                 // Set protocol level to HTTP/1.0
-                final BasicHttpEntityEnclosingRequest post = new BasicHttpEntityEnclosingRequest(
+                final BasicHttpRequest post = new BasicHttpRequest(
                         "POST", "/", HttpVersion.HTTP_1_0);
                 final byte[] data = testData.get(r);
                 final ByteArrayEntity outgoing = new ByteArrayEntity(data);
@@ -453,16 +441,13 @@ public class TestSyncHttp {
                     final HttpResponse response,
                     final HttpContext context) throws HttpException, IOException {
 
-                if (request instanceof HttpEntityEnclosingRequest) {
-                    final HttpEntity incoming = ((HttpEntityEnclosingRequest) request).getEntity();
+                final HttpEntity incoming = request.getEntity();
+                if (incoming != null) {
                     final byte[] data = EntityUtils.toByteArray(incoming);
 
                     final ByteArrayEntity outgoing = new ByteArrayEntity(data);
                     outgoing.setChunked(true);
                     response.setEntity(outgoing);
-                } else {
-                    final StringEntity outgoing = new StringEntity("No content");
-                    response.setEntity(outgoing);
                 }
             }
 
@@ -480,7 +465,7 @@ public class TestSyncHttp {
                     client.connect(host, conn);
                 }
 
-                final BasicHttpEntityEnclosingRequest post = new BasicHttpEntityEnclosingRequest("POST", "/");
+                final BasicHttpRequest post = new BasicHttpRequest("POST", "/");
                 final byte[] data = testData.get(r);
                 final ByteArrayEntity outgoing = new ByteArrayEntity(data);
                 outgoing.setChunked(true);
@@ -543,7 +528,7 @@ public class TestSyncHttp {
                     final HttpContext context) throws HttpException {
                 final Header someheader = request.getFirstHeader("Secret");
                 if (someheader != null) {
-                    int secretNumber;
+                    final int secretNumber;
                     try {
                         secretNumber = Integer.parseInt(someheader.getValue());
                     } catch (final NumberFormatException ex) {
@@ -571,7 +556,7 @@ public class TestSyncHttp {
                     client.connect(host, conn);
                 }
 
-                final BasicHttpEntityEnclosingRequest post = new BasicHttpEntityEnclosingRequest("POST", "/");
+                final BasicHttpRequest post = new BasicHttpRequest("POST", "/");
                 post.addHeader("Secret", Integer.toString(r));
                 post.setEntity(new StringEntity("No content " + r, ContentType.TEXT_PLAIN));
 
@@ -609,9 +594,7 @@ public class TestSyncHttp {
         public RepeatingEntity(final String content, final Charset charset, final int n) {
             super();
             final Charset cs = charset != null ? charset : Charset.forName("US-ASCII");
-            byte[] b;
-            b = content.getBytes(cs);
-            this.raw = b;
+            this.raw = content.getBytes(cs);
             this.n = n;
         }
 
@@ -679,7 +662,7 @@ public class TestSyncHttp {
                     final HttpResponse response,
                     final HttpContext context) throws HttpException, IOException {
 
-                if (request instanceof HttpEntityEnclosingRequest) {
+                if (request instanceof HttpRequest) {
                     int n = 1;
                     String s = request.getRequestLine().getUri();
                     if (s.startsWith("/?n=")) {
@@ -696,16 +679,18 @@ public class TestSyncHttp {
                         }
                     }
 
-                    final HttpEntity incoming = ((HttpEntityEnclosingRequest) request).getEntity();
-                    final String line = EntityUtils.toString(incoming);
-                    final ContentType contentType = ContentType.getOrDefault(incoming);
-                    Charset charset = contentType.getCharset();
-                    if (charset == null) {
-                        charset = Consts.ISO_8859_1;
+                    final HttpEntity incoming = request.getEntity();
+                    if (incoming != null) {
+                        final String line = EntityUtils.toString(incoming);
+                        final ContentType contentType = ContentType.getOrDefault(incoming);
+                        Charset charset = contentType.getCharset();
+                        if (charset == null) {
+                            charset = Consts.ISO_8859_1;
+                        }
+                        final RepeatingEntity outgoing = new RepeatingEntity(line, charset, n);
+                        outgoing.setChunked(n % 2 == 0);
+                        response.setEntity(outgoing);
                     }
-                    final RepeatingEntity outgoing = new RepeatingEntity(line, charset, n);
-                    outgoing.setChunked(n % 2 == 0);
-                    response.setEntity(outgoing);
                 } else {
                     throw new HttpException("Invalid request: POST request expected");
                 }
@@ -724,7 +709,7 @@ public class TestSyncHttp {
                         client.connect(host, conn);
                     }
 
-                    final BasicHttpEntityEnclosingRequest post = new BasicHttpEntityEnclosingRequest(
+                    final BasicHttpRequest post = new BasicHttpRequest(
                             "POST", "/?n=" + n);
                     final StringEntity outgoing = new StringEntity(pattern);
                     outgoing.setChunked(n % 2 == 0);
@@ -770,14 +755,11 @@ public class TestSyncHttp {
                     final HttpResponse response,
                     final HttpContext context) throws HttpException, IOException {
 
-                if (request instanceof HttpEntityEnclosingRequest) {
-                    final HttpEntity incoming = ((HttpEntityEnclosingRequest) request).getEntity();
+                final HttpEntity incoming = request.getEntity();
+                if (incoming != null) {
                     final byte[] data = EntityUtils.toByteArray(incoming);
                     final ByteArrayEntity outgoing = new ByteArrayEntity(data);
                     response.setEntity(outgoing);
-                } else {
-                    final StringEntity outgoing = new StringEntity("No content");
-                    response.setEntity(outgoing);
                 }
             }
 
@@ -793,7 +775,7 @@ public class TestSyncHttp {
                 client.connect(host, conn);
             }
 
-            final BasicHttpEntityEnclosingRequest post = new BasicHttpEntityEnclosingRequest("POST", "/");
+            final BasicHttpRequest post = new BasicHttpRequest("POST", "/");
             post.setEntity(null);
 
             final HttpResponse response = this.client.execute(post, host, conn);
@@ -816,14 +798,11 @@ public class TestSyncHttp {
                     final HttpResponse response,
                     final HttpContext context) throws HttpException, IOException {
 
-                if (request instanceof HttpEntityEnclosingRequest) {
-                    final HttpEntity incoming = ((HttpEntityEnclosingRequest) request).getEntity();
+                final HttpEntity incoming = request.getEntity();
+                if (incoming != null) {
                     final byte[] data = EntityUtils.toByteArray(incoming);
                     final ByteArrayEntity outgoing = new ByteArrayEntity(data);
                     response.setEntity(outgoing);
-                } else {
-                    final StringEntity outgoing = new StringEntity("No content");
-                    response.setEntity(outgoing);
                 }
             }
 
@@ -839,15 +818,14 @@ public class TestSyncHttp {
                 client.connect(host, conn);
             }
 
-            final BasicHttpEntityEnclosingRequest post = new BasicHttpEntityEnclosingRequest("POST", "/");
+            final BasicHttpRequest post = new BasicHttpRequest("POST", "/");
             post.setEntity(null);
 
             this.client = new HttpClient(new ImmutableHttpProcessor(
-                    new HttpRequestInterceptor[] {
-                            new RequestTargetHost(),
-                            new RequestConnControl(),
-                            new RequestUserAgent(),
-                            new RequestExpectContinue() }));
+                    new RequestTargetHost(),
+                    new RequestConnControl(),
+                    new RequestUserAgent(),
+                    new RequestExpectContinue()));
 
             final HttpResponse response = this.client.execute(post, host, conn);
             Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
@@ -869,14 +847,11 @@ public class TestSyncHttp {
                     final HttpResponse response,
                     final HttpContext context) throws HttpException, IOException {
 
-                if (request instanceof HttpEntityEnclosingRequest) {
-                    final HttpEntity incoming = ((HttpEntityEnclosingRequest) request).getEntity();
+                final HttpEntity incoming = request.getEntity();
+                if (incoming != null) {
                     final byte[] data = EntityUtils.toByteArray(incoming);
                     final ByteArrayEntity outgoing = new ByteArrayEntity(data);
                     response.setEntity(outgoing);
-                } else {
-                    final StringEntity outgoing = new StringEntity("No content");
-                    response.setEntity(outgoing);
                 }
             }
 
@@ -892,7 +867,7 @@ public class TestSyncHttp {
                 client.connect(host, conn);
             }
 
-            final BasicHttpEntityEnclosingRequest post = new BasicHttpEntityEnclosingRequest("POST", "/");
+            final BasicHttpRequest post = new BasicHttpRequest("POST", "/");
             post.setEntity(null);
 
             this.client = new HttpClient(new ImmutableHttpProcessor(

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestBasicMessages.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestBasicMessages.java?rev=1641930&r1=1641929&r2=1641930&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestBasicMessages.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/message/TestBasicMessages.java Wed Nov 26 20:30:08 2014
@@ -135,21 +135,8 @@ public class TestBasicMessages {
     }
 
     @Test
-    public void testDefaultEntityEnclosingRequestConstructors() {
-        BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("GET", "/");
-        Assert.assertNotNull(request.getProtocolVersion());
-        Assert.assertEquals("GET", request.getRequestLine().getMethod());
-        Assert.assertEquals("/", request.getRequestLine().getUri());
-
-        request = new BasicHttpEntityEnclosingRequest("GET", "/", HttpVersion.HTTP_1_0);
-        Assert.assertEquals(HttpVersion.HTTP_1_0, request.getProtocolVersion());
-        Assert.assertEquals("GET", request.getRequestLine().getMethod());
-        Assert.assertEquals("/", request.getRequestLine().getUri());
-    }
-
-    @Test
     public void testSetRequestEntity() {
-        final BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("GET", "/");
+        final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
         Assert.assertNull(request.getEntity());
 
         final HttpEntity entity = new BasicHttpEntity();
@@ -157,13 +144,5 @@ public class TestBasicMessages {
         Assert.assertTrue(entity == request.getEntity());
     }
 
-    @Test
-    public void testExpectContinue() {
-        final BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("GET", "/");
-        Assert.assertFalse(request.expectContinue());
-        request.addHeader("Expect", "100-Continue");
-        Assert.assertTrue(request.expectContinue());
-    }
-
 }
 

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpRequestExecutor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpRequestExecutor.java?rev=1641930&r1=1641929&r2=1641930&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpRequestExecutor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpRequestExecutor.java Wed Nov 26 20:30:08 2014
@@ -32,13 +32,11 @@ import java.io.IOException;
 import org.apache.http.HeaderElements;
 import org.apache.http.HttpClientConnection;
 import org.apache.http.HttpEntity;
-import org.apache.http.HttpEntityEnclosingRequest;
 import org.apache.http.HttpHeaders;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpVersion;
 import org.apache.http.ProtocolException;
-import org.apache.http.message.BasicHttpEntityEnclosingRequest;
 import org.apache.http.message.BasicHttpRequest;
 import org.apache.http.message.BasicHttpResponse;
 import org.junit.Assert;
@@ -269,7 +267,7 @@ public class TestHttpRequestExecutor {
         final HttpRequestExecutor executor = new HttpRequestExecutor();
 
         final HttpCoreContext context = HttpCoreContext.create();
-        final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        final HttpRequest request = new BasicHttpRequest("POST", "/");
 //        request.addHeader(HTTP.EXPECT_DIRECTIVE, HTTP.EXPECT_CONTINUE);
         final HttpEntity entity = Mockito.mock(HttpEntity.class);
         request.setEntity(entity);
@@ -298,7 +296,7 @@ public class TestHttpRequestExecutor {
         final HttpRequestExecutor executor = new HttpRequestExecutor();
 
         final HttpCoreContext context = HttpCoreContext.create();
-        final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        final HttpRequest request = new BasicHttpRequest("POST", "/");
         request.addHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
         final HttpEntity entity = Mockito.mock(HttpEntity.class);
         request.setEntity(entity);
@@ -332,7 +330,7 @@ public class TestHttpRequestExecutor {
         final HttpRequestExecutor executor = new HttpRequestExecutor();
 
         final HttpCoreContext context = HttpCoreContext.create();
-        final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        final HttpRequest request = new BasicHttpRequest("POST", "/");
         request.addHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
         final HttpEntity entity = Mockito.mock(HttpEntity.class);
         request.setEntity(entity);
@@ -363,7 +361,7 @@ public class TestHttpRequestExecutor {
         final HttpRequestExecutor executor = new HttpRequestExecutor();
 
         final HttpCoreContext context = HttpCoreContext.create();
-        final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        final HttpRequest request = new BasicHttpRequest("POST", "/");
         request.addHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
         final HttpEntity entity = Mockito.mock(HttpEntity.class);
         request.setEntity(entity);
@@ -391,7 +389,7 @@ public class TestHttpRequestExecutor {
         final HttpRequestExecutor executor = new HttpRequestExecutor();
 
         final HttpCoreContext context = HttpCoreContext.create();
-        final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        final HttpRequest request = new BasicHttpRequest("POST", "/");
         request.addHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
         final HttpEntity entity = Mockito.mock(HttpEntity.class);
         request.setEntity(entity);

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpService.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpService.java?rev=1641930&r1=1641929&r2=1641930&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpService.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestHttpService.java Wed Nov 26 20:30:08 2014
@@ -31,7 +31,6 @@ import java.io.InputStream;
 
 import org.apache.http.ConnectionReuseStrategy;
 import org.apache.http.HeaderElements;
-import org.apache.http.HttpEntityEnclosingRequest;
 import org.apache.http.HttpException;
 import org.apache.http.HttpHeaders;
 import org.apache.http.HttpRequest;
@@ -44,7 +43,6 @@ import org.apache.http.MethodNotSupporte
 import org.apache.http.ProtocolException;
 import org.apache.http.UnsupportedHttpVersionException;
 import org.apache.http.entity.InputStreamEntity;
-import org.apache.http.message.BasicHttpEntityEnclosingRequest;
 import org.apache.http.message.BasicHttpRequest;
 import org.apache.http.message.BasicHttpResponse;
 import org.junit.Assert;
@@ -169,7 +167,7 @@ public class TestHttpService {
                 handlerResolver);
         final HttpCoreContext context = HttpCoreContext.create();
         final HttpServerConnection conn = Mockito.mock(HttpServerConnection.class);
-        final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        final HttpRequest request = new BasicHttpRequest("POST", "/");
         final InputStream instream = Mockito.mock(InputStream.class);
         final InputStreamEntity entity = new InputStreamEntity(instream, -1);
         request.setEntity(entity);
@@ -211,7 +209,7 @@ public class TestHttpService {
                 handlerResolver);
         final HttpCoreContext context = HttpCoreContext.create();
         final HttpServerConnection conn = Mockito.mock(HttpServerConnection.class);
-        final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        final HttpRequest request = new BasicHttpRequest("POST", "/");
         request.addHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
         final InputStream instream = Mockito.mock(InputStream.class);
         final InputStreamEntity entity = new InputStreamEntity(instream, -1);
@@ -270,7 +268,7 @@ public class TestHttpService {
                 expectationVerifier);
         final HttpCoreContext context = HttpCoreContext.create();
         final HttpServerConnection conn = Mockito.mock(HttpServerConnection.class);
-        final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        final HttpRequest request = new BasicHttpRequest("POST", "/");
         request.addHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
         final InputStream instream = Mockito.mock(InputStream.class);
         final InputStreamEntity entity = new InputStreamEntity(instream, -1);
@@ -314,8 +312,8 @@ public class TestHttpService {
                 expectationVerifier);
         final HttpCoreContext context = HttpCoreContext.create();
         final HttpServerConnection conn = Mockito.mock(HttpServerConnection.class);
-        final HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
-        request.addHeader(HttpHeaders.EXPECT, HeaderElements.CONTINUE);
+        final HttpRequest request = new BasicHttpRequest("POST", "/");
+        request.addHeader(HttpHeaders.EXPECT, "100-continue");
         final InputStream instream = Mockito.mock(InputStream.class);
         final InputStreamEntity entity = new InputStreamEntity(instream, -1);
         request.setEntity(entity);

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestStandardInterceptors.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestStandardInterceptors.java?rev=1641930&r1=1641929&r2=1641930&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestStandardInterceptors.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/protocol/TestStandardInterceptors.java Wed Nov 26 20:30:08 2014
@@ -43,7 +43,6 @@ import org.apache.http.ProtocolException
 import org.apache.http.entity.BasicHttpEntity;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.message.BasicHeader;
-import org.apache.http.message.BasicHttpEntityEnclosingRequest;
 import org.apache.http.message.BasicHttpRequest;
 import org.apache.http.message.BasicHttpResponse;
 import org.junit.Assert;
@@ -101,9 +100,9 @@ public class TestStandardInterceptors {
     @Test
     public void testRequestContentProtocolException() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final BasicHttpRequest request1 = new BasicHttpEntityEnclosingRequest("POST", "/");
+        final BasicHttpRequest request1 = new BasicHttpRequest("POST", "/");
         request1.addHeader(new BasicHeader(HttpHeaders.TRANSFER_ENCODING, "chunked"));
-        final BasicHttpRequest request2 = new BasicHttpEntityEnclosingRequest("POST", "/");
+        final BasicHttpRequest request2 = new BasicHttpRequest("POST", "/");
         request2.addHeader(new BasicHeader(HttpHeaders.CONTENT_LENGTH, "12"));
 
         final RequestContent interceptor = new RequestContent();
@@ -124,20 +123,19 @@ public class TestStandardInterceptors {
     @Test
     public void testRequestContentNullEntity() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final BasicHttpRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        final BasicHttpRequest request = new BasicHttpRequest("POST", "/");
 
         final RequestContent interceptor = new RequestContent();
         interceptor.process(request, context);
         final Header header = request.getFirstHeader(HttpHeaders.CONTENT_LENGTH);
-        Assert.assertNotNull(header);
-        Assert.assertEquals("0", header.getValue());
+        Assert.assertNull(header);
         Assert.assertNull(request.getFirstHeader(HttpHeaders.TRANSFER_ENCODING));
    }
 
     @Test
     public void testRequestContentEntityContentLengthDelimitedHTTP11() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        final BasicHttpRequest request = new BasicHttpRequest("POST", "/");
         final String s = "whatever";
         final StringEntity entity = new StringEntity(s, Consts.ASCII);
         request.setEntity(entity);
@@ -153,7 +151,7 @@ public class TestStandardInterceptors {
     @Test
     public void testRequestContentEntityChunkedHTTP11() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        final BasicHttpRequest request = new BasicHttpRequest("POST", "/");
         final String s = "whatever";
         final StringEntity entity = new StringEntity(s, Consts.ASCII);
         entity.setChunked(true);
@@ -170,7 +168,7 @@ public class TestStandardInterceptors {
     @Test
     public void testRequestContentEntityUnknownLengthHTTP11() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        final BasicHttpRequest request = new BasicHttpRequest("POST", "/");
         final BasicHttpEntity entity = new BasicHttpEntity();
         entity.setContentLength(-1);
         entity.setChunked(false);
@@ -187,8 +185,7 @@ public class TestStandardInterceptors {
     @Test
     public void testRequestContentEntityChunkedHTTP10() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest(
-                "POST", "/", HttpVersion.HTTP_1_0);
+        final BasicHttpRequest request = new BasicHttpRequest("POST", "/", HttpVersion.HTTP_1_0);
         final String s = "whatever";
         final StringEntity entity = new StringEntity(s, Consts.ASCII);
         entity.setChunked(true);
@@ -206,7 +203,7 @@ public class TestStandardInterceptors {
     @Test
     public void testRequestContentTypeAndEncoding() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        final BasicHttpRequest request = new BasicHttpRequest("POST", "/");
         final BasicHttpEntity entity = new BasicHttpEntity();
         entity.setContentType("whatever");
         entity.setContentEncoding("whatever");
@@ -225,7 +222,7 @@ public class TestStandardInterceptors {
     @Test
     public void testRequestContentNullTypeAndEncoding() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        final BasicHttpRequest request = new BasicHttpRequest("POST", "/");
         final BasicHttpEntity entity = new BasicHttpEntity();
         request.setEntity(entity);
 
@@ -238,7 +235,7 @@ public class TestStandardInterceptors {
     @Test
     public void testRequestContentEntityUnknownLengthHTTP10() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest(
+        final BasicHttpRequest request = new BasicHttpRequest(
                 "POST", "/", HttpVersion.HTTP_1_0);
         final BasicHttpEntity entity = new BasicHttpEntity();
         entity.setContentLength(-1);
@@ -278,27 +275,34 @@ public class TestStandardInterceptors {
     public void testRequestContentOverwriteHeaders() throws Exception {
         final RequestContent interceptor = new RequestContent(true);
         final HttpContext context = new BasicHttpContext(null);
-        final BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        final BasicHttpRequest request = new BasicHttpRequest("POST", "/");
         request.addHeader(new BasicHeader(HttpHeaders.CONTENT_LENGTH, "10"));
         request.addHeader(new BasicHeader(HttpHeaders.TRANSFER_ENCODING, "whatever"));
+        request.setEntity(new StringEntity(""));
         interceptor.process(request, context);
-        Assert.assertEquals("0", request.getFirstHeader(HttpHeaders.CONTENT_LENGTH).getValue());
+        final Header h1 = request.getFirstHeader(HttpHeaders.CONTENT_LENGTH);
+        Assert.assertNotNull(h1);
+        Assert.assertEquals("0", h1.getValue());
     }
 
     @Test
     public void testRequestContentAddHeaders() throws Exception {
         final RequestContent interceptor = new RequestContent(true);
         final HttpContext context = new BasicHttpContext(null);
-        final BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        final BasicHttpRequest request = new BasicHttpRequest("POST", "/");
+        request.setEntity(new StringEntity(""));
         interceptor.process(request, context);
-        Assert.assertEquals("0", request.getFirstHeader(HttpHeaders.CONTENT_LENGTH).getValue());
-        Assert.assertNull(request.getFirstHeader(HttpHeaders.TRANSFER_ENCODING));
+        final Header h1 = request.getFirstHeader(HttpHeaders.CONTENT_LENGTH);
+        Assert.assertNotNull(h1);
+        Assert.assertEquals("0", h1.getValue());
+        final Header h2 = request.getFirstHeader(HttpHeaders.TRANSFER_ENCODING);
+        Assert.assertNull(h2);
     }
 
     @Test
     public void testRequestExpectContinueGenerated() throws Exception {
         final HttpCoreContext context = HttpCoreContext.create();
-        final BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        final BasicHttpRequest request = new BasicHttpRequest("POST", "/");
         final String s = "whatever";
         final StringEntity entity = new StringEntity(s, Consts.ASCII);
         request.setEntity(entity);
@@ -312,8 +316,7 @@ public class TestStandardInterceptors {
     @Test
     public void testRequestExpectContinueHTTP10() throws Exception {
         final HttpCoreContext context = HttpCoreContext.create();
-        final BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest(
-                "POST", "/", HttpVersion.HTTP_1_0);
+        final BasicHttpRequest request = new BasicHttpRequest("POST", "/", HttpVersion.HTTP_1_0);
         final String s = "whatever";
         final StringEntity entity = new StringEntity(s, Consts.ASCII);
         request.setEntity(entity);
@@ -326,7 +329,7 @@ public class TestStandardInterceptors {
     @Test
     public void testRequestExpectContinueZeroContent() throws Exception {
         final HttpCoreContext context = HttpCoreContext.create();
-        final BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", "/");
+        final BasicHttpRequest request = new BasicHttpRequest("POST", "/");
         final String s = "";
         final StringEntity entity = new StringEntity(s, Consts.ASCII);
         request.setEntity(entity);
@@ -933,9 +936,8 @@ public class TestStandardInterceptors {
     @Test
     public void testRequestDateGenerated() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final BasicHttpRequest request =
-            new BasicHttpEntityEnclosingRequest("POST", "/");
-        //BasicHttpRequest request = new BasicHttpRequest("GET", "/");
+        final BasicHttpRequest request = new BasicHttpRequest("POST", "/");
+        request.setEntity(new StringEntity("stuff"));
 
         final RequestDate interceptor = new RequestDate();
         interceptor.process(request, context);



Mime
View raw message