hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1735164 [4/4] - in /httpcomponents/httpcore/trunk: httpcore5-ab/src/main/java/org/apache/hc/core5/http/benchmark/ httpcore5-ab/src/test/java/org/apache/hc/core5/http/benchmark/ httpcore5/src/examples/org/apache/hc/core5/http/examples/ http...
Date Tue, 15 Mar 2016 20:35:36 GMT
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicHttpResponse.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicHttpResponse.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicHttpResponse.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicHttpResponse.java Tue Mar 15 20:35:34 2016
@@ -27,7 +27,6 @@
 
 package org.apache.hc.core5.http.message;
 
-import org.apache.hc.core5.http.HttpVersion;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -38,61 +37,34 @@ public class TestBasicHttpResponse {
 
     @Test
     public void testBasics() {
-        final BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
-        Assert.assertEquals(HttpVersion.HTTP_1_1, response.getProtocolVersion());
-        Assert.assertEquals(HttpVersion.HTTP_1_1, response.getStatusLine().getProtocolVersion());
+        final BasicHttpResponse response = new BasicHttpResponse(200, "OK");
         Assert.assertEquals(200, response.getCode());
-        Assert.assertEquals("OK", response.getStatusLine().getReasonPhrase());
+        Assert.assertEquals("OK", response.getReasonPhrase());
     }
 
     @Test
     public void testStatusLineMutation() {
-        final BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
-        Assert.assertEquals(HttpVersion.HTTP_1_1, response.getStatusLine().getProtocolVersion());
+        final BasicHttpResponse response = new BasicHttpResponse(200, "OK");
         Assert.assertEquals(200, response.getCode());
-        Assert.assertEquals("OK", response.getStatusLine().getReasonPhrase());
+        Assert.assertEquals("OK", response.getReasonPhrase());
         response.setReasonPhrase("Kind of OK");
-        Assert.assertEquals(HttpVersion.HTTP_1_1, response.getStatusLine().getProtocolVersion());
         Assert.assertEquals(200, response.getCode());
-        Assert.assertEquals("Kind of OK", response.getStatusLine().getReasonPhrase());
-        response.setStatusCode(299);
-        Assert.assertEquals(HttpVersion.HTTP_1_1, response.getStatusLine().getProtocolVersion());
+        Assert.assertEquals("Kind of OK", response.getReasonPhrase());
+        response.setCode(299);
         Assert.assertEquals(299, response.getCode());
-        Assert.assertEquals(null, response.getStatusLine().getReasonPhrase());
-        response.setStatusLine(HttpVersion.HTTP_1_0, 298);
-        Assert.assertEquals(HttpVersion.HTTP_1_0, response.getStatusLine().getProtocolVersion());
-        Assert.assertEquals(298, response.getCode());
-        Assert.assertEquals(null, response.getStatusLine().getReasonPhrase());
-        response.setStatusLine(HttpVersion.HTTP_1_1, 200, "OK");
-        Assert.assertEquals(HttpVersion.HTTP_1_1, response.getStatusLine().getProtocolVersion());
-        Assert.assertEquals(200, response.getCode());
-        Assert.assertEquals("OK", response.getStatusLine().getReasonPhrase());
-        response.setStatusLine(new BasicStatusLine(HttpVersion.HTTP_1_0, 500, "Boom"));
-        Assert.assertEquals(HttpVersion.HTTP_1_0, response.getStatusLine().getProtocolVersion());
-        Assert.assertEquals(500, response.getCode());
-        Assert.assertEquals("Boom", response.getStatusLine().getReasonPhrase());
+        Assert.assertEquals(null, response.getReasonPhrase());
     }
 
     @Test
     public void testInvalidStatusCode() {
         try {
-            new BasicHttpResponse(HttpVersion.HTTP_1_1, -200, "OK");
-            Assert.fail("IllegalArgumentException expected");
-        } catch (final IllegalArgumentException expected) {
-        }
-        final BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
-        try {
-            response.setStatusCode(-1);
-            Assert.fail("IllegalArgumentException expected");
-        } catch (final IllegalArgumentException expected) {
-        }
-        try {
-            response.setStatusLine(HttpVersion.HTTP_1_1, -1);
+            new BasicHttpResponse(-200, "OK");
             Assert.fail("IllegalArgumentException expected");
         } catch (final IllegalArgumentException expected) {
         }
+        final BasicHttpResponse response = new BasicHttpResponse(200, "OK");
         try {
-            response.setStatusLine(HttpVersion.HTTP_1_1, -1, "not ok");
+            response.setCode(-1);
             Assert.fail("IllegalArgumentException expected");
         } catch (final IllegalArgumentException expected) {
         }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicLineFormatter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicLineFormatter.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicLineFormatter.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicLineFormatter.java Tue Mar 15 20:35:34 2016
@@ -30,8 +30,6 @@ package org.apache.hc.core5.http.message
 import org.apache.hc.core5.http.Header;
 import org.apache.hc.core5.http.HttpStatus;
 import org.apache.hc.core5.http.HttpVersion;
-import org.apache.hc.core5.http.RequestLine;
-import org.apache.hc.core5.http.StatusLine;
 import org.apache.hc.core5.util.CharArrayBuffer;
 import org.junit.Assert;
 import org.junit.Before;
@@ -58,7 +56,7 @@ public class TestBasicLineFormatter {
 
     @Test
     public void testRLFormatting() throws Exception {
-        final RequestLine requestline = new BasicRequestLine("GET", "/stuff", HttpVersion.HTTP_1_1);
+        final RequestLine requestline = new RequestLine("GET", "/stuff", HttpVersion.HTTP_1_1);
         final CharArrayBuffer buf = new CharArrayBuffer(64);
         this.formatter.formatRequestLine(buf, requestline);
         Assert.assertEquals("GET /stuff HTTP/1.1", buf.toString());
@@ -67,7 +65,7 @@ public class TestBasicLineFormatter {
     @Test
     public void testRLFormattingInvalidInput() throws Exception {
         final CharArrayBuffer buf = new CharArrayBuffer(64);
-        final RequestLine requestline = new BasicRequestLine("GET", "/stuff", HttpVersion.HTTP_1_1);
+        final RequestLine requestline = new RequestLine("GET", "/stuff", HttpVersion.HTTP_1_1);
         try {
             this.formatter.formatRequestLine(null, requestline);
             Assert.fail("IllegalArgumentException should habe been thrown");
@@ -85,12 +83,12 @@ public class TestBasicLineFormatter {
     @Test
     public void testSLFormatting() throws Exception {
         final CharArrayBuffer buf = new CharArrayBuffer(64);
-        final StatusLine statusline1 = new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        final StatusLine statusline1 = new StatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
         this.formatter.formatStatusLine(buf, statusline1);
         Assert.assertEquals("HTTP/1.1 200 OK", buf.toString());
 
         buf.clear();
-        final StatusLine statusline2 = new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, null);
+        final StatusLine statusline2 = new StatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, null);
         this.formatter.formatStatusLine(buf, statusline2);
         Assert.assertEquals("HTTP/1.1 200 ", buf.toString());
         // see "testSLParseSuccess" in TestBasicLineParser:
@@ -100,7 +98,7 @@ public class TestBasicLineFormatter {
     @Test
     public void testSLFormattingInvalidInput() throws Exception {
         final CharArrayBuffer buf = new CharArrayBuffer(64);
-        final StatusLine statusline = new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        final StatusLine statusline = new StatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
         try {
             this.formatter.formatStatusLine(null, statusline);
             Assert.fail("IllegalArgumentException should habe been thrown");

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicLineParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicLineParser.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicLineParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicLineParser.java Tue Mar 15 20:35:34 2016
@@ -30,8 +30,6 @@ package org.apache.hc.core5.http.message
 import org.apache.hc.core5.http.Header;
 import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.ParseException;
-import org.apache.hc.core5.http.RequestLine;
-import org.apache.hc.core5.http.StatusLine;
 import org.apache.hc.core5.util.CharArrayBuffer;
 import org.junit.Assert;
 import org.junit.Before;

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicMessages.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicMessages.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicMessages.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicMessages.java Tue Mar 15 20:35:34 2016
@@ -31,7 +31,6 @@ import org.apache.hc.core5.http.HttpEnti
 import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpResponse;
 import org.apache.hc.core5.http.HttpStatus;
-import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.entity.BasicHttpEntity;
 import org.junit.Assert;
 import org.junit.Test;
@@ -44,48 +43,30 @@ public class TestBasicMessages {
 
     @Test
     public void testDefaultResponseConstructors() {
-        HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_0, HttpStatus.SC_BAD_REQUEST, "Bad Request");
-        Assert.assertNotNull(response.getProtocolVersion());
-        Assert.assertEquals(HttpVersion.HTTP_1_0, response.getProtocolVersion());
+        HttpResponse response = new BasicHttpResponse(HttpStatus.SC_BAD_REQUEST, "Bad Request");
         Assert.assertEquals(HttpStatus.SC_BAD_REQUEST, response.getCode());
 
-        response = new BasicHttpResponse(new BasicStatusLine(
-                HttpVersion.HTTP_1_1, HttpStatus.SC_INTERNAL_SERVER_ERROR, "whatever"));
-        Assert.assertNotNull(response.getProtocolVersion());
-        Assert.assertEquals(HttpVersion.HTTP_1_1, response.getProtocolVersion());
+        response = new BasicHttpResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, "whatever");
         Assert.assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, response.getCode());
-        Assert.assertEquals("whatever", response.getStatusLine().getReasonPhrase());
+        Assert.assertEquals("whatever", response.getReasonPhrase());
     }
 
     @Test
     public void testSetResponseStatus() {
-        HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
-        Assert.assertNotNull(response.getProtocolVersion());
-        Assert.assertNotNull(response.getStatusLine());
+        HttpResponse response = new BasicHttpResponse(200, "OK");
+        Assert.assertNotNull(response.getCode());
         Assert.assertEquals(200, response.getCode());
 
-        response = new BasicHttpResponse(HttpVersion.HTTP_1_0, HttpStatus.SC_BAD_REQUEST, "Bad Request");
-        Assert.assertNotNull(response.getProtocolVersion());
-        Assert.assertEquals(HttpVersion.HTTP_1_0, response.getProtocolVersion());
+        response = new BasicHttpResponse(HttpStatus.SC_BAD_REQUEST, "Bad Request");
         Assert.assertEquals(HttpStatus.SC_BAD_REQUEST, response.getCode());
 
-        response = new BasicHttpResponse(new BasicStatusLine(
-                HttpVersion.HTTP_1_1, HttpStatus.SC_INTERNAL_SERVER_ERROR, "whatever"));
-        Assert.assertNotNull(response.getProtocolVersion());
-        Assert.assertEquals(HttpVersion.HTTP_1_1, response.getProtocolVersion());
+        response = new BasicHttpResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, "whatever");
         Assert.assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, response.getCode());
-        Assert.assertEquals("whatever", response.getStatusLine().getReasonPhrase());
+        Assert.assertEquals("whatever", response.getReasonPhrase());
 
-        response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         try {
-            response.setStatusCode(-23);
-            Assert.fail("IllegalArgumentException should have been thrown");
-        } catch (final IllegalArgumentException ex) {
-            // expected
-        }
-        response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
-        try {
-            response.setStatusLine(null);
+            response.setCode(-23);
             Assert.fail("IllegalArgumentException should have been thrown");
         } catch (final IllegalArgumentException ex) {
             // expected
@@ -94,7 +75,7 @@ public class TestBasicMessages {
 
     @Test
     public void testSetResponseEntity() {
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         Assert.assertNull(response.getEntity());
 
         final HttpEntity entity = new BasicHttpEntity();
@@ -105,14 +86,12 @@ public class TestBasicMessages {
     @Test
     public void testDefaultRequestConstructors() {
         HttpRequest request = new BasicHttpRequest("WHATEVER", "/");
-        Assert.assertNotNull(request.getProtocolVersion());
-        Assert.assertEquals("WHATEVER", request.getRequestLine().getMethod());
-        Assert.assertEquals("/", request.getRequestLine().getUri());
-
-        request = new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_0);
-        Assert.assertEquals(HttpVersion.HTTP_1_0, request.getProtocolVersion());
-        Assert.assertEquals("GET", request.getRequestLine().getMethod());
-        Assert.assertEquals("/", request.getRequestLine().getUri());
+        Assert.assertEquals("WHATEVER", request.getMethod());
+        Assert.assertEquals("/", request.getUri());
+
+        request = new BasicHttpRequest("GET", "/");
+        Assert.assertEquals("GET", request.getMethod());
+        Assert.assertEquals("/", request.getUri());
 
         try {
             new BasicHttpRequest(null, null);
@@ -125,12 +104,6 @@ public class TestBasicMessages {
             Assert.fail("IllegalArgumentException should have been thrown");
         } catch (final IllegalArgumentException ex) {
             // expected
-        }
-        try {
-            new BasicHttpRequest(null);
-            Assert.fail("IllegalArgumentException should have been thrown");
-        } catch (final IllegalArgumentException ex) {
-            // expected
         }
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestStandardInterceptors.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestStandardInterceptors.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestStandardInterceptors.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestStandardInterceptors.java Tue Mar 15 20:35:34 2016
@@ -186,7 +186,8 @@ public class TestStandardInterceptors {
     @Test
     public void testRequestContentEntityChunkedHTTP10() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final BasicHttpRequest request = new BasicHttpRequest("POST", "/", HttpVersion.HTTP_1_0);
+        context.setProtocolVersion(HttpVersion.HTTP_1_0);
+        final BasicHttpRequest request = new BasicHttpRequest("POST", "/");
         final String s = "whatever";
         final StringEntity entity = new StringEntity(s, StandardCharsets.US_ASCII);
         entity.setChunked(true);
@@ -236,8 +237,8 @@ public class TestStandardInterceptors {
     @Test
     public void testRequestContentEntityUnknownLengthHTTP10() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final BasicHttpRequest request = new BasicHttpRequest(
-                "POST", "/", HttpVersion.HTTP_1_0);
+        context.setProtocolVersion(HttpVersion.HTTP_1_0);
+        final BasicHttpRequest request = new BasicHttpRequest("POST", "/");
         final BasicHttpEntity entity = new BasicHttpEntity();
         entity.setContentLength(-1);
         entity.setChunked(false);
@@ -335,7 +336,8 @@ public class TestStandardInterceptors {
     @Test
     public void testRequestExpectContinueHTTP10() throws Exception {
         final HttpCoreContext context = HttpCoreContext.create();
-        final BasicHttpRequest request = new BasicHttpRequest("POST", "/", HttpVersion.HTTP_1_0);
+        context.setProtocolVersion(HttpVersion.HTTP_1_0);
+        final BasicHttpRequest request = new BasicHttpRequest("POST", "/");
         final String s = "whatever";
         final StringEntity entity = new StringEntity(s, StandardCharsets.US_ASCII);
         request.setEntity(entity);
@@ -437,8 +439,8 @@ public class TestStandardInterceptors {
     @Test
     public void testRequestTargetHostMissingHostHTTP10() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final BasicHttpRequest request = new BasicHttpRequest(
-                "GET", "/", HttpVersion.HTTP_1_0);
+        context.setProtocolVersion(HttpVersion.HTTP_1_0);
+        final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
         final RequestTargetHost interceptor = new RequestTargetHost();
         interceptor.process(request, context);
         final Header header = request.getFirstHeader(HttpHeaders.HOST);
@@ -491,9 +493,10 @@ public class TestStandardInterceptors {
     @Test
     public void testRequestTargetHostConnectHttp10() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
+        context.setProtocolVersion(HttpVersion.HTTP_1_0);
         final HttpHost host = new HttpHost("somehost", 8080, "http");
         context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, host);
-        final BasicHttpRequest request = new BasicHttpRequest("CONNECT", "/", HttpVersion.HTTP_1_0);
+        final BasicHttpRequest request = new BasicHttpRequest("CONNECT", "/");
         final RequestTargetHost interceptor = new RequestTargetHost();
         interceptor.process(request, context);
         final Header header = request.getFirstHeader(HttpHeaders.HOST);
@@ -547,7 +550,7 @@ public class TestStandardInterceptors {
     @Test
     public void testResponseConnControlNoEntity() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         final ResponseConnControl interceptor = new ResponseConnControl();
         interceptor.process(response, context);
         final Header header = response.getFirstHeader(HttpHeaders.CONNECTION);
@@ -557,7 +560,7 @@ public class TestStandardInterceptors {
     @Test
     public void testResponseConnControlEntityContentLength() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         final StringEntity entity = new StringEntity("whatever");
         response.setEntity(entity);
         final ResponseConnControl interceptor = new ResponseConnControl();
@@ -572,7 +575,7 @@ public class TestStandardInterceptors {
         final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
         request.addHeader(new BasicHeader(HttpHeaders.CONNECTION, "keep-alive"));
         context.setAttribute(HttpCoreContext.HTTP_REQUEST, request);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         final BasicHttpEntity entity = new BasicHttpEntity();
         response.setEntity(entity);
         final ResponseConnControl interceptor = new ResponseConnControl();
@@ -585,7 +588,7 @@ public class TestStandardInterceptors {
     @Test
     public void testResponseConnControlEntityChunked() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         final BasicHttpEntity entity = new BasicHttpEntity();
         entity.setChunked(true);
         response.setEntity(entity);
@@ -598,12 +601,12 @@ public class TestStandardInterceptors {
     @Test
     public void testResponseConnControlEntityUnknownContentLengthHTTP10() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
+        context.setProtocolVersion(HttpVersion.HTTP_1_0);
         final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
         request.addHeader(new BasicHeader(HttpHeaders.CONNECTION, "keep-alive"));
         context.setAttribute(HttpCoreContext.HTTP_REQUEST, request);
 
-        final BasicHttpResponse response = new BasicHttpResponse(
-                HttpVersion.HTTP_1_0, HttpStatus.SC_OK, "OK");
+        final BasicHttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         final BasicHttpEntity entity = new BasicHttpEntity();
         response.setEntity(entity);
         final ResponseConnControl interceptor = new ResponseConnControl();
@@ -620,7 +623,7 @@ public class TestStandardInterceptors {
         request.addHeader(new BasicHeader(HttpHeaders.CONNECTION, "keep-alive"));
         context.setAttribute(HttpCoreContext.HTTP_REQUEST, request);
 
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         final StringEntity entity = new StringEntity("whatever");
         response.setEntity(entity);
         final ResponseConnControl interceptor = new ResponseConnControl();
@@ -636,7 +639,7 @@ public class TestStandardInterceptors {
         final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
         context.setAttribute(HttpCoreContext.HTTP_REQUEST, request);
 
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         final StringEntity entity = new StringEntity("whatever");
         response.setEntity(entity);
         final ResponseConnControl interceptor = new ResponseConnControl();
@@ -648,10 +651,11 @@ public class TestStandardInterceptors {
     @Test
     public void testResponseConnControl10Client11Response() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final BasicHttpRequest request = new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_0);
+        context.setProtocolVersion(HttpVersion.HTTP_1_0);
+        final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
         context.setAttribute(HttpCoreContext.HTTP_REQUEST, request);
 
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         final StringEntity entity = new StringEntity("whatever");
         response.setEntity(entity);
         final ResponseConnControl interceptor = new ResponseConnControl();
@@ -680,8 +684,7 @@ public class TestStandardInterceptors {
                 HttpStatus.SC_NOT_IMPLEMENTED };
 
         for (final int statusCode : statusCodes) {
-            final BasicHttpResponse response = new BasicHttpResponse(
-                    HttpVersion.HTTP_1_1, statusCode, "Unreasonable");
+            final HttpResponse response = new BasicHttpResponse(statusCode, "Unreasonable");
             interceptor.process(response, context);
             final Header header = response.getFirstHeader(HttpHeaders.CONNECTION);
             Assert.assertNotNull(header);
@@ -699,8 +702,7 @@ public class TestStandardInterceptors {
 
         final ResponseConnControl interceptor = new ResponseConnControl();
 
-        final BasicHttpResponse response = new BasicHttpResponse(
-                HttpVersion.HTTP_1_1, 200, "OK");
+        final HttpResponse response = new BasicHttpResponse(200, "OK");
         response.setHeader(HttpHeaders.CONNECTION, "close");
         interceptor.process(response, context);
         final Header header = response.getFirstHeader(HttpHeaders.CONNECTION);
@@ -718,7 +720,7 @@ public class TestStandardInterceptors {
             // expected
         }
         try {
-            final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+            final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
             interceptor.process(response, null);
             Assert.fail("IllegalArgumentException should have been thrown");
         } catch (final IllegalArgumentException ex) {
@@ -729,7 +731,7 @@ public class TestStandardInterceptors {
     @Test
     public void testResponseContentNoEntity() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         final ResponseContent interceptor = new ResponseContent();
         interceptor.process(response, context);
         final Header header = response.getFirstHeader(HttpHeaders.CONTENT_LENGTH);
@@ -740,8 +742,8 @@ public class TestStandardInterceptors {
     @Test
     public void testResponseContentStatusNoContent() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
-        response.setStatusCode(HttpStatus.SC_NO_CONTENT);
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
+        response.setCode(HttpStatus.SC_NO_CONTENT);
         final ResponseContent interceptor = new ResponseContent();
         interceptor.process(response, context);
         final Header header = response.getFirstHeader(HttpHeaders.CONTENT_LENGTH);
@@ -751,8 +753,8 @@ public class TestStandardInterceptors {
     @Test
     public void testResponseContentStatusResetContent() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
-        response.setStatusCode(HttpStatus.SC_RESET_CONTENT);
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
+        response.setCode(HttpStatus.SC_RESET_CONTENT);
         final ResponseContent interceptor = new ResponseContent();
         interceptor.process(response, context);
         final Header header = response.getFirstHeader(HttpHeaders.CONTENT_LENGTH);
@@ -762,8 +764,8 @@ public class TestStandardInterceptors {
     @Test
     public void testResponseContentStatusNotModified() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
-        response.setStatusCode(HttpStatus.SC_NOT_MODIFIED);
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
+        response.setCode(HttpStatus.SC_NOT_MODIFIED);
         final ResponseContent interceptor = new ResponseContent();
         interceptor.process(response, context);
         final Header header = response.getFirstHeader(HttpHeaders.CONTENT_LENGTH);
@@ -773,7 +775,7 @@ public class TestStandardInterceptors {
     @Test
     public void testResponseContentEntityChunked() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         final BasicHttpEntity entity = new BasicHttpEntity();
         entity.setChunked(true);
         response.setEntity(entity);
@@ -789,7 +791,7 @@ public class TestStandardInterceptors {
     @Test
     public void testResponseContentEntityContentLenghtDelimited() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         final BasicHttpEntity entity = new BasicHttpEntity();
         entity.setContentLength (10);
         response.setEntity(entity);
@@ -805,7 +807,7 @@ public class TestStandardInterceptors {
     @Test
     public void testResponseContentEntityUnknownContentLength() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         final BasicHttpEntity entity = new BasicHttpEntity();
         response.setEntity(entity);
         final ResponseContent interceptor = new ResponseContent();
@@ -819,7 +821,8 @@ public class TestStandardInterceptors {
     @Test
     public void testResponseContentEntityChunkedHTTP10() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final BasicHttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_0, HttpStatus.SC_OK, "OK");
+        context.setProtocolVersion(HttpVersion.HTTP_1_0);
+        final BasicHttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         final BasicHttpEntity entity = new BasicHttpEntity();
         entity.setChunked(true);
         response.setEntity(entity);
@@ -834,7 +837,7 @@ public class TestStandardInterceptors {
     @Test
     public void testResponseContentEntityNoContentTypeAndEncoding() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         final BasicHttpEntity entity = new BasicHttpEntity();
         response.setEntity(entity);
         final ResponseContent interceptor = new ResponseContent();
@@ -848,7 +851,7 @@ public class TestStandardInterceptors {
     @Test
     public void testResponseContentEntityContentTypeAndEncoding() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         final BasicHttpEntity entity = new BasicHttpEntity();
         entity.setContentEncoding("whatever");
         entity.setContentType("whatever");
@@ -879,7 +882,7 @@ public class TestStandardInterceptors {
         final ResponseContent interceptor = new ResponseContent();
         final HttpContext context = new BasicHttpContext(null);
         try {
-            final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+            final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
             response.addHeader(new BasicHeader(HttpHeaders.CONTENT_LENGTH, "10"));
             interceptor.process(response, context);
             Assert.fail("ProtocolException should have been thrown");
@@ -887,7 +890,7 @@ public class TestStandardInterceptors {
             // expected
         }
         try {
-            final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+            final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
             response.addHeader(new BasicHeader(HttpHeaders.TRANSFER_ENCODING, "stuff"));
             interceptor.process(response, context);
             Assert.fail("ProtocolException should have been thrown");
@@ -900,7 +903,7 @@ public class TestStandardInterceptors {
     public void testResponseContentOverwriteHeaders() throws Exception {
         final ResponseContent interceptor = new ResponseContent(true);
         final HttpContext context = new BasicHttpContext(null);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         response.addHeader(new BasicHeader(HttpHeaders.CONTENT_LENGTH, "10"));
         response.addHeader(new BasicHeader(HttpHeaders.TRANSFER_ENCODING, "whatever"));
         interceptor.process(response, context);
@@ -911,7 +914,7 @@ public class TestStandardInterceptors {
     public void testResponseContentAddHeaders() throws Exception {
         final ResponseContent interceptor = new ResponseContent(true);
         final HttpContext context = new BasicHttpContext(null);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         interceptor.process(response, context);
         Assert.assertEquals("0", response.getFirstHeader(HttpHeaders.CONTENT_LENGTH).getValue());
         Assert.assertNull(response.getFirstHeader(HttpHeaders.TRANSFER_ENCODING));
@@ -920,7 +923,7 @@ public class TestStandardInterceptors {
     @Test
     public void testResponseContentEntityWithTrailers() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         final String s = "whatever";
         final StringEntity entity = new StringEntity(s, StandardCharsets.US_ASCII);
         response.setEntity(new HttpEntityWithTrailers(entity,
@@ -938,7 +941,7 @@ public class TestStandardInterceptors {
     @Test
     public void testResponseDateGenerated() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         final ResponseDate interceptor = new ResponseDate();
         interceptor.process(response, context);
         final Header h1 = response.getFirstHeader(HttpHeaders.DATE);
@@ -951,8 +954,8 @@ public class TestStandardInterceptors {
     @Test
     public void testResponseDateNotGenerated() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
-        response.setStatusCode(199);
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
+        response.setCode(199);
         final ResponseDate interceptor = new ResponseDate();
         interceptor.process(response, context);
         final Header h1 = response.getFirstHeader(HttpHeaders.DATE);
@@ -1010,7 +1013,7 @@ public class TestStandardInterceptors {
     @Test
     public void testResponseServerGenerated() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         final ResponseServer interceptor = new ResponseServer("some server");
         interceptor.process(response, context);
         final Header h1 = response.getFirstHeader(HttpHeaders.SERVER);
@@ -1021,7 +1024,7 @@ public class TestStandardInterceptors {
     @Test
     public void testResponseServerNotGenerated() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         response.addHeader(new BasicHeader(HttpHeaders.SERVER, "whatever"));
         final ResponseServer interceptor = new ResponseServer("some server");
         interceptor.process(response, context);
@@ -1033,7 +1036,7 @@ public class TestStandardInterceptors {
     @Test
     public void testResponseServerMissing() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
         final ResponseServer interceptor = new ResponseServer();
         interceptor.process(response, context);
         final Header h1 = response.getFirstHeader(HttpHeaders.SERVER);
@@ -1054,7 +1057,8 @@ public class TestStandardInterceptors {
     @Test
     public void testRequestHttp10HostHeaderAbsent() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final BasicHttpRequest request = new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_0);
+        final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
+        request.setVersion(HttpVersion.HTTP_1_0);
         final RequestValidateHost interceptor = new RequestValidateHost();
         interceptor.process(request, context);
     }
@@ -1062,7 +1066,7 @@ public class TestStandardInterceptors {
     @Test
     public void testRequestHttp11HostHeaderPresent() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final BasicHttpRequest request = new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);
+        final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
         request.setHeader(HttpHeaders.HOST, "blah");
         final RequestValidateHost interceptor = new RequestValidateHost();
         interceptor.process(request, context);
@@ -1071,7 +1075,7 @@ public class TestStandardInterceptors {
     @Test(expected = ProtocolException.class)
     public void testRequestHttp11HostHeaderAbsent() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final BasicHttpRequest request = new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);
+        final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
         final RequestValidateHost interceptor = new RequestValidateHost();
         interceptor.process(request, context);
     }
@@ -1079,7 +1083,7 @@ public class TestStandardInterceptors {
     @Test(expected = ProtocolException.class)
     public void testRequestHttp11MultipleHostHeaders() throws Exception {
         final HttpContext context = new BasicHttpContext(null);
-        final BasicHttpRequest request = new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);
+        final BasicHttpRequest request = new BasicHttpRequest("GET", "/");
         request.addHeader(HttpHeaders.HOST, "blah");
         request.addHeader(HttpHeaders.HOST, "blah");
         final RequestValidateHost interceptor = new RequestValidateHost();

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/HttpServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/HttpServer.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/HttpServer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/HttpServer.java Tue Mar 15 20:35:34 2016
@@ -117,7 +117,7 @@ public class HttpServer {
         }
     }
 
-    static class LoggingConnFactory implements HttpConnectionFactory<LoggingBHttpServerConnection> {
+    class LoggingConnFactory implements HttpConnectionFactory<LoggingBHttpServerConnection> {
 
         @Override
         public LoggingBHttpServerConnection createConnection(final Socket socket) throws IOException {

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/LoggingBHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/LoggingBHttpClientConnection.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/LoggingBHttpClientConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/LoggingBHttpClientConnection.java Tue Mar 15 20:35:34 2016
@@ -41,10 +41,13 @@ import org.apache.hc.core5.http.ContentL
 import org.apache.hc.core5.http.Header;
 import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.config.MessageConstraints;
 import org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection;
 import org.apache.hc.core5.http.io.HttpMessageParserFactory;
 import org.apache.hc.core5.http.io.HttpMessageWriterFactory;
+import org.apache.hc.core5.http.message.RequestLine;
+import org.apache.hc.core5.http.message.StatusLine;
 
 public class LoggingBHttpClientConnection extends DefaultBHttpClientConnection {
 
@@ -115,7 +118,9 @@ public class LoggingBHttpClientConnectio
     @Override
     protected void onResponseReceived(final HttpResponse response) {
         if (response != null && this.headerlog.isDebugEnabled()) {
-            this.headerlog.debug(this.id + " << " + response.getStatusLine().toString());
+            this.headerlog.debug(this.id + " << " + new StatusLine(
+                    response.getVersion() != null ? response.getVersion() : HttpVersion.HTTP_1_1,
+                    response.getCode(), response.getReasonPhrase()));
             final Header[] headers = response.getAllHeaders();
             for (final Header header : headers) {
                 this.headerlog.debug(this.id + " << " + header.toString());
@@ -126,7 +131,8 @@ public class LoggingBHttpClientConnectio
     @Override
     protected void onRequestSubmitted(final HttpRequest request) {
         if (request != null && this.headerlog.isDebugEnabled()) {
-            this.headerlog.debug(id + " >> " + request.getRequestLine().toString());
+            this.headerlog.debug(id + " >> " + new RequestLine(request.getMethod(), request.getUri(),
+                    request.getVersion() != null ? request.getVersion() : HttpVersion.HTTP_1_1));
             final Header[] headers = request.getAllHeaders();
             for (final Header header : headers) {
                 this.headerlog.debug(this.id + " >> " + header.toString());

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/LoggingBHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/LoggingBHttpServerConnection.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/LoggingBHttpServerConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/io/LoggingBHttpServerConnection.java Tue Mar 15 20:35:34 2016
@@ -41,10 +41,13 @@ import org.apache.hc.core5.http.ContentL
 import org.apache.hc.core5.http.Header;
 import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.config.MessageConstraints;
 import org.apache.hc.core5.http.impl.io.DefaultBHttpServerConnection;
 import org.apache.hc.core5.http.io.HttpMessageParserFactory;
 import org.apache.hc.core5.http.io.HttpMessageWriterFactory;
+import org.apache.hc.core5.http.message.RequestLine;
+import org.apache.hc.core5.http.message.StatusLine;
 
 public class LoggingBHttpServerConnection extends DefaultBHttpServerConnection {
 
@@ -115,7 +118,8 @@ public class LoggingBHttpServerConnectio
     @Override
     protected void onRequestReceived(final HttpRequest request) {
         if (request != null && this.headerlog.isDebugEnabled()) {
-            this.headerlog.debug(this.id + " >> " + request.getRequestLine().toString());
+            this.headerlog.debug(id + " >> " + new RequestLine(request.getMethod(), request.getUri(),
+                    request.getVersion() != null ? request.getVersion() : HttpVersion.HTTP_1_1));
             final Header[] headers = request.getAllHeaders();
             for (final Header header : headers) {
                 this.headerlog.debug(this.id + " >> " + header.toString());
@@ -126,7 +130,9 @@ public class LoggingBHttpServerConnectio
     @Override
     protected void onResponseSubmitted(final HttpResponse response) {
         if (response != null && this.headerlog.isDebugEnabled()) {
-            this.headerlog.debug(this.id + " << " + response.getStatusLine().toString());
+            this.headerlog.debug(this.id + " << " + new StatusLine(
+                    response.getVersion() != null ? response.getVersion() : HttpVersion.HTTP_1_1,
+                    response.getCode(), response.getReasonPhrase()));
             final Header[] headers = response.getAllHeaders();
             for (final Header header : headers) {
                 this.headerlog.debug(this.id + " << " + header.toString());

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/nio/LoggingNHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/nio/LoggingNHttpClientConnection.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/nio/LoggingNHttpClientConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/nio/LoggingNHttpClientConnection.java Tue Mar 15 20:35:34 2016
@@ -36,7 +36,10 @@ import org.apache.hc.core5.http.Header;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.impl.nio.DefaultNHttpClientConnection;
+import org.apache.hc.core5.http.message.RequestLine;
+import org.apache.hc.core5.http.message.StatusLine;
 import org.apache.hc.core5.http.nio.NHttpClientEventHandler;
 import org.apache.hc.core5.reactor.IOSession;
 
@@ -81,7 +84,7 @@ public class LoggingNHttpClientConnectio
     @Override
     public void submitRequest(final HttpRequest request) throws IOException, HttpException {
         if (this.log.isDebugEnabled()) {
-            this.log.debug(this.id + ": "  + request.getRequestLine().toString());
+            this.log.debug(this.id + ": "  + request.getMethod() + " " + request.getUri());
         }
         super.submitRequest(request);
     }
@@ -105,7 +108,9 @@ public class LoggingNHttpClientConnectio
     @Override
     protected void onResponseReceived(final HttpResponse response) {
         if (response != null && this.headerlog.isDebugEnabled()) {
-            this.headerlog.debug(this.id + " << " + response.getStatusLine().toString());
+            this.headerlog.debug(this.id + " << " + new StatusLine(
+                    response.getVersion() != null ? response.getVersion() : HttpVersion.HTTP_1_1,
+                    response.getCode(), response.getReasonPhrase()));
             final Header[] headers = response.getAllHeaders();
             for (final Header header : headers) {
                 this.headerlog.debug(this.id + " << " + header.toString());
@@ -116,7 +121,8 @@ public class LoggingNHttpClientConnectio
     @Override
     protected void onRequestSubmitted(final HttpRequest request) {
         if (request != null && this.headerlog.isDebugEnabled()) {
-            this.headerlog.debug(id + " >> " + request.getRequestLine().toString());
+            this.headerlog.debug(id + " >> " + new RequestLine(request.getMethod(), request.getUri(),
+                    request.getVersion() != null ? request.getVersion() : HttpVersion.HTTP_1_1));
             final Header[] headers = request.getAllHeaders();
             for (final Header header : headers) {
                 this.headerlog.debug(this.id + " >> " + header.toString());

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/nio/LoggingNHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/nio/LoggingNHttpServerConnection.java?rev=1735164&r1=1735163&r2=1735164&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/nio/LoggingNHttpServerConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/nio/LoggingNHttpServerConnection.java Tue Mar 15 20:35:34 2016
@@ -36,7 +36,10 @@ import org.apache.hc.core5.http.Header;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.impl.nio.DefaultNHttpServerConnection;
+import org.apache.hc.core5.http.message.RequestLine;
+import org.apache.hc.core5.http.message.StatusLine;
 import org.apache.hc.core5.http.nio.NHttpServerEventHandler;
 import org.apache.hc.core5.reactor.IOSession;
 
@@ -81,7 +84,7 @@ public class LoggingNHttpServerConnectio
     @Override
     public void submitResponse(final HttpResponse response) throws IOException, HttpException {
         if (this.log.isDebugEnabled()) {
-            this.log.debug(this.id + ": "  + response.getStatusLine().toString());
+            this.log.debug(this.id + ": "  + response.getCode() + " " + response.getReasonPhrase());
         }
         super.submitResponse(response);
     }
@@ -105,7 +108,8 @@ public class LoggingNHttpServerConnectio
     @Override
     protected void onRequestReceived(final HttpRequest request) {
         if (request != null && this.headerlog.isDebugEnabled()) {
-            this.headerlog.debug(this.id + " >> " + request.getRequestLine().toString());
+            this.headerlog.debug(id + " >> " + new RequestLine(request.getMethod(), request.getUri(),
+                    request.getVersion() != null ? request.getVersion() : HttpVersion.HTTP_1_1));
             final Header[] headers = request.getAllHeaders();
             for (final Header header : headers) {
                 this.headerlog.debug(this.id + " >> " + header.toString());
@@ -116,7 +120,9 @@ public class LoggingNHttpServerConnectio
     @Override
     protected void onResponseSubmitted(final HttpResponse response) {
         if (response != null && this.headerlog.isDebugEnabled()) {
-            this.headerlog.debug(this.id + " << " + response.getStatusLine().toString());
+            this.headerlog.debug(this.id + " << " + new StatusLine(
+                    response.getVersion() != null ? response.getVersion() : HttpVersion.HTTP_1_1,
+                    response.getCode(), response.getReasonPhrase()));
             final Header[] headers = response.getAllHeaders();
             for (final Header header : headers) {
                 this.headerlog.debug(this.id + " << " + header.toString());



Mime
View raw message