hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1776187 [17/21] - in /httpcomponents/httpclient/trunk: ./ httpclient5-cache/src/main/java/org/apache/hc/client5/http/cache/ httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/ httpclient5-cache/src/test/java/org/apache/h...
Date Tue, 27 Dec 2016 19:48:10 GMT
Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestClientAuthentication.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestClientAuthentication.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestClientAuthentication.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestClientAuthentication.java Tue Dec 27 19:48:07 2016
@@ -57,29 +57,25 @@ import org.apache.hc.client5.http.method
 import org.apache.hc.client5.http.protocol.ClientProtocolException;
 import org.apache.hc.client5.http.protocol.HttpClientContext;
 import org.apache.hc.client5.http.protocol.NonRepeatableRequestException;
+import org.apache.hc.core5.http.ClassicHttpRequest;
+import org.apache.hc.core5.http.ClassicHttpResponse;
 import org.apache.hc.core5.http.HeaderElements;
 import org.apache.hc.core5.http.HttpConnection;
 import org.apache.hc.core5.http.HttpEntity;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpHeaders;
 import org.apache.hc.core5.http.HttpHost;
-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.entity.EntityUtils;
-import org.apache.hc.core5.http.entity.InputStreamEntity;
-import org.apache.hc.core5.http.entity.StringEntity;
+import org.apache.hc.core5.http.impl.HttpProcessors;
+import org.apache.hc.core5.http.io.HttpExpectationVerifier;
 import org.apache.hc.core5.http.io.HttpRequestHandler;
+import org.apache.hc.core5.http.io.entity.EntityUtils;
+import org.apache.hc.core5.http.io.entity.InputStreamEntity;
+import org.apache.hc.core5.http.io.entity.StringEntity;
 import org.apache.hc.core5.http.message.BasicHeader;
 import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.http.protocol.HttpCoreContext;
-import org.apache.hc.core5.http.protocol.HttpExpectationVerifier;
 import org.apache.hc.core5.http.protocol.HttpProcessor;
-import org.apache.hc.core5.http.protocol.HttpProcessorBuilder;
-import org.apache.hc.core5.http.protocol.ResponseConnControl;
-import org.apache.hc.core5.http.protocol.ResponseContent;
-import org.apache.hc.core5.http.protocol.ResponseDate;
-import org.apache.hc.core5.http.protocol.ResponseServer;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -92,11 +88,7 @@ public class TestClientAuthentication ex
     @Before @Override
     public void setUp() throws Exception {
         super.setUp();
-        final HttpProcessor httpproc = HttpProcessorBuilder.create()
-            .add(new ResponseDate())
-            .add(new ResponseServer(LocalServerTestBase.ORIGIN))
-            .add(new ResponseContent())
-            .add(new ResponseConnControl())
+        final HttpProcessor httpproc = HttpProcessors.customServer(null)
             .add(new RequestBasicAuth())
             .add(new ResponseBasicUnauthorized()).build();
         this.serverBootstrap.setHttpProcessor(httpproc);
@@ -106,14 +98,14 @@ public class TestClientAuthentication ex
 
         @Override
         public void handle(
-                final HttpRequest request,
-                final HttpResponse response,
+                final ClassicHttpRequest request,
+                final ClassicHttpResponse response,
                 final HttpContext context) throws HttpException, IOException {
             final String creds = (String) context.getAttribute("creds");
             if (creds == null || !creds.equals("test:test")) {
-                response.setStatusCode(HttpStatus.SC_UNAUTHORIZED);
+                response.setCode(HttpStatus.SC_UNAUTHORIZED);
             } else {
-                response.setStatusCode(HttpStatus.SC_OK);
+                response.setCode(HttpStatus.SC_OK);
                 final StringEntity entity = new StringEntity("success", StandardCharsets.US_ASCII);
                 response.setEntity(entity);
             }
@@ -132,14 +124,14 @@ public class TestClientAuthentication ex
 
         @Override
         public void verify(
-                final HttpRequest request,
-                final HttpResponse response,
+                final ClassicHttpRequest request,
+                final ClassicHttpResponse response,
                 final HttpContext context) throws HttpException {
             final String creds = this.authTokenExtractor.extract(request);
             if (creds == null || !creds.equals("test:test")) {
-                response.setStatusCode(HttpStatus.SC_UNAUTHORIZED);
+                response.setCode(HttpStatus.SC_UNAUTHORIZED);
             } else {
-                response.setStatusCode(HttpStatus.SC_CONTINUE);
+                response.setCode(HttpStatus.SC_CONTINUE);
             }
         }
 
@@ -178,9 +170,9 @@ public class TestClientAuthentication ex
         context.setCredentialsProvider(credsProvider);
         final HttpGet httpget = new HttpGet("/");
 
-        final HttpResponse response = this.httpclient.execute(target, httpget, context);
+        final ClassicHttpResponse response = this.httpclient.execute(target, httpget, context);
         final HttpEntity entity = response.getEntity();
-        Assert.assertEquals(HttpStatus.SC_UNAUTHORIZED, response.getStatusLine().getStatusCode());
+        Assert.assertEquals(HttpStatus.SC_UNAUTHORIZED, response.getCode());
         Assert.assertNotNull(entity);
         EntityUtils.consume(entity);
         final AuthScope authscope = credsProvider.getAuthScope();
@@ -200,9 +192,9 @@ public class TestClientAuthentication ex
         context.setCredentialsProvider(credsProvider);
         final HttpGet httpget = new HttpGet("/");
 
-        final HttpResponse response = this.httpclient.execute(target, httpget, context);
+        final ClassicHttpResponse response = this.httpclient.execute(target, httpget, context);
         final HttpEntity entity = response.getEntity();
-        Assert.assertEquals(HttpStatus.SC_UNAUTHORIZED, response.getStatusLine().getStatusCode());
+        Assert.assertEquals(HttpStatus.SC_UNAUTHORIZED, response.getCode());
         Assert.assertNotNull(entity);
         EntityUtils.consume(entity);
         final AuthScope authscope = credsProvider.getAuthScope();
@@ -222,9 +214,9 @@ public class TestClientAuthentication ex
 
         final HttpHost target = start();
 
-        final HttpResponse response = this.httpclient.execute(target, httpget, context);
+        final ClassicHttpResponse response = this.httpclient.execute(target, httpget, context);
         final HttpEntity entity = response.getEntity();
-        Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
+        Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
         Assert.assertNotNull(entity);
         EntityUtils.consume(entity);
         final AuthScope authscope = credsProvider.getAuthScope();
@@ -234,11 +226,7 @@ public class TestClientAuthentication ex
 
     @Test
     public void testBasicAuthenticationSuccessOnNonRepeatablePutExpectContinue() throws Exception {
-        final HttpProcessor httpproc = HttpProcessorBuilder.create()
-            .add(new ResponseDate())
-            .add(new ResponseServer(LocalServerTestBase.ORIGIN))
-            .add(new ResponseContent())
-            .add(new ResponseConnControl())
+        final HttpProcessor httpproc = HttpProcessors.customServer(null)
             .add(new RequestBasicAuth())
             .add(new ResponseBasicUnauthorized()).build();
         this.serverBootstrap.setHttpProcessor(httpproc)
@@ -261,9 +249,9 @@ public class TestClientAuthentication ex
                 new UsernamePasswordCredentials("test", "test".toCharArray()));
         context.setCredentialsProvider(credsProvider);
 
-        final HttpResponse response = this.httpclient.execute(target, httpput, context);
+        final ClassicHttpResponse response = this.httpclient.execute(target, httpput, context);
         final HttpEntity entity = response.getEntity();
-        Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
+        Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
         Assert.assertNotNull(entity);
     }
 
@@ -311,9 +299,9 @@ public class TestClientAuthentication ex
                 new UsernamePasswordCredentials("test", "test".toCharArray()));
         context.setCredentialsProvider(credsProvider);
 
-        final HttpResponse response = this.httpclient.execute(target, httppost, context);
+        final ClassicHttpResponse response = this.httpclient.execute(target, httppost, context);
         final HttpEntity entity = response.getEntity();
-        Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
+        Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
         Assert.assertNotNull(entity);
         EntityUtils.consume(entity);
         final AuthScope authscope = credsProvider.getAuthScope();
@@ -390,15 +378,15 @@ public class TestClientAuthentication ex
 
         final HttpGet httpget = new HttpGet("/");
 
-        final HttpResponse response1 = this.httpclient.execute(target, httpget, context);
+        final ClassicHttpResponse response1 = this.httpclient.execute(target, httpget, context);
         final HttpEntity entity1 = response1.getEntity();
-        Assert.assertEquals(HttpStatus.SC_OK, response1.getStatusLine().getStatusCode());
+        Assert.assertEquals(HttpStatus.SC_OK, response1.getCode());
         Assert.assertNotNull(entity1);
         EntityUtils.consume(entity1);
 
-        final HttpResponse response2 = this.httpclient.execute(target, httpget, context);
+        final ClassicHttpResponse response2 = this.httpclient.execute(target, httpget, context);
         final HttpEntity entity2 = response1.getEntity();
-        Assert.assertEquals(HttpStatus.SC_OK, response2.getStatusLine().getStatusCode());
+        Assert.assertEquals(HttpStatus.SC_OK, response2.getCode());
         Assert.assertNotNull(entity2);
         EntityUtils.consume(entity2);
 
@@ -417,15 +405,15 @@ public class TestClientAuthentication ex
 
         @Override
         public void handle(
-                final HttpRequest request,
-                final HttpResponse response,
+                final ClassicHttpRequest request,
+                final ClassicHttpResponse response,
                 final HttpContext context) throws HttpException, IOException {
             final String givenCreds = (String) context.getAttribute("creds");
             if (givenCreds == null || !givenCreds.equals(this.realmCreds)) {
-                response.setStatusCode(HttpStatus.SC_UNAUTHORIZED);
+                response.setCode(HttpStatus.SC_UNAUTHORIZED);
                 response.addHeader(HttpHeaders.WWW_AUTHENTICATE, "Basic realm=\"" + this.realm + "\"");
             } else {
-                response.setStatusCode(HttpStatus.SC_OK);
+                response.setCode(HttpStatus.SC_OK);
                 final StringEntity entity = new StringEntity("success", StandardCharsets.US_ASCII);
                 response.setEntity(entity);
             }
@@ -458,25 +446,25 @@ public class TestClientAuthentication ex
 
         final HttpGet httpget1 = new HttpGet("/this");
 
-        final HttpResponse response1 = this.httpclient.execute(target, httpget1, context);
+        final ClassicHttpResponse response1 = this.httpclient.execute(target, httpget1, context);
         final HttpEntity entity1 = response1.getEntity();
-        Assert.assertEquals(HttpStatus.SC_OK, response1.getStatusLine().getStatusCode());
+        Assert.assertEquals(HttpStatus.SC_OK, response1.getCode());
         Assert.assertNotNull(entity1);
         EntityUtils.consume(entity1);
 
         final HttpGet httpget2 = new HttpGet("/this");
 
-        final HttpResponse response2 = this.httpclient.execute(target, httpget2, context);
+        final ClassicHttpResponse response2 = this.httpclient.execute(target, httpget2, context);
         final HttpEntity entity2 = response1.getEntity();
-        Assert.assertEquals(HttpStatus.SC_OK, response2.getStatusLine().getStatusCode());
+        Assert.assertEquals(HttpStatus.SC_OK, response2.getCode());
         Assert.assertNotNull(entity2);
         EntityUtils.consume(entity2);
 
         final HttpGet httpget3 = new HttpGet("/that");
 
-        final HttpResponse response3 = this.httpclient.execute(target, httpget3, context);
+        final ClassicHttpResponse response3 = this.httpclient.execute(target, httpget3, context);
         final HttpEntity entity3 = response1.getEntity();
-        Assert.assertEquals(HttpStatus.SC_OK, response3.getStatusLine().getStatusCode());
+        Assert.assertEquals(HttpStatus.SC_OK, response3.getCode());
         Assert.assertNotNull(entity3);
         EntityUtils.consume(entity3);
 
@@ -491,9 +479,9 @@ public class TestClientAuthentication ex
         final HttpGet httpget = new HttpGet("http://test:test@" +  target.toHostString() + "/");
 
         final HttpClientContext context = HttpClientContext.create();
-        final HttpResponse response = this.httpclient.execute(target, httpget, context);
+        final ClassicHttpResponse response = this.httpclient.execute(target, httpget, context);
         final HttpEntity entity = response.getEntity();
-        Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
+        Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
         Assert.assertNotNull(entity);
         EntityUtils.consume(entity);
     }
@@ -506,9 +494,9 @@ public class TestClientAuthentication ex
         final HttpGet httpget = new HttpGet("http://test:all-wrong@" +  target.toHostString() + "/");
 
         final HttpClientContext context = HttpClientContext.create();
-        final HttpResponse response = this.httpclient.execute(target, httpget, context);
+        final ClassicHttpResponse response = this.httpclient.execute(target, httpget, context);
         final HttpEntity entity = response.getEntity();
-        Assert.assertEquals(HttpStatus.SC_UNAUTHORIZED, response.getStatusLine().getStatusCode());
+        Assert.assertEquals(HttpStatus.SC_UNAUTHORIZED, response.getCode());
         Assert.assertNotNull(entity);
         EntityUtils.consume(entity);
     }
@@ -521,14 +509,14 @@ public class TestClientAuthentication ex
 
         @Override
         public void handle(
-                final HttpRequest request,
-                final HttpResponse response,
+                final ClassicHttpRequest request,
+                final ClassicHttpResponse response,
                 final HttpContext context) throws HttpException, IOException {
             final HttpConnection conn = (HttpConnection) context.getAttribute(HttpCoreContext.HTTP_CONNECTION);
             final InetSocketAddress socketAddress = (InetSocketAddress) conn.getLocalAddress();
             final String localhost = socketAddress.getHostName();
             final int port = socketAddress.getPort();
-            response.setStatusCode(HttpStatus.SC_MOVED_PERMANENTLY);
+            response.setCode(HttpStatus.SC_MOVED_PERMANENTLY);
             response.addHeader(new BasicHeader("Location",
                     "http://test:test@" + localhost + ":" + port + "/"));
         }
@@ -545,9 +533,9 @@ public class TestClientAuthentication ex
         final HttpGet httpget = new HttpGet("http://" +  target.toHostString() + "/thatway");
         final HttpClientContext context = HttpClientContext.create();
 
-        final HttpResponse response = this.httpclient.execute(target, httpget, context);
+        final ClassicHttpResponse response = this.httpclient.execute(target, httpget, context);
         final HttpEntity entity = response.getEntity();
-        Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
+        Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
         Assert.assertNotNull(entity);
         EntityUtils.consume(entity);
     }
@@ -563,15 +551,15 @@ public class TestClientAuthentication ex
 
         @Override
         public void handle(
-                final HttpRequest request,
-                final HttpResponse response,
+                final ClassicHttpRequest request,
+                final ClassicHttpResponse response,
                 final HttpContext context) throws HttpException, IOException {
             this.count.incrementAndGet();
             final String creds = (String) context.getAttribute("creds");
             if (creds == null || !creds.equals("test:test")) {
-                response.setStatusCode(HttpStatus.SC_UNAUTHORIZED);
+                response.setCode(HttpStatus.SC_UNAUTHORIZED);
             } else {
-                response.setStatusCode(HttpStatus.SC_OK);
+                response.setCode(HttpStatus.SC_OK);
                 final StringEntity entity = new StringEntity("success", StandardCharsets.US_ASCII);
                 response.setEntity(entity);
             }
@@ -598,9 +586,9 @@ public class TestClientAuthentication ex
         context.setAuthCache(authCache);
 
         final HttpGet httpget = new HttpGet("/");
-        final HttpResponse response1 = this.httpclient.execute(target, httpget, context);
+        final ClassicHttpResponse response1 = this.httpclient.execute(target, httpget, context);
         final HttpEntity entity1 = response1.getEntity();
-        Assert.assertEquals(HttpStatus.SC_OK, response1.getStatusLine().getStatusCode());
+        Assert.assertEquals(HttpStatus.SC_OK, response1.getCode());
         Assert.assertNotNull(entity1);
         EntityUtils.consume(entity1);
 
@@ -624,9 +612,9 @@ public class TestClientAuthentication ex
         context.setCredentialsProvider(credsProvider);
 
         final HttpGet httpget = new HttpGet("/");
-        final HttpResponse response1 = this.httpclient.execute(target, httpget, context);
+        final ClassicHttpResponse response1 = this.httpclient.execute(target, httpget, context);
         final HttpEntity entity1 = response1.getEntity();
-        Assert.assertEquals(HttpStatus.SC_UNAUTHORIZED, response1.getStatusLine().getStatusCode());
+        Assert.assertEquals(HttpStatus.SC_UNAUTHORIZED, response1.getCode());
         Assert.assertNotNull(entity1);
         EntityUtils.consume(entity1);
 
@@ -637,14 +625,14 @@ public class TestClientAuthentication ex
 
         @Override
         public void handle(
-                final HttpRequest request,
-                final HttpResponse response,
+                final ClassicHttpRequest request,
+                final ClassicHttpResponse response,
                 final HttpContext context) throws HttpException, IOException {
             final String creds = (String) context.getAttribute("creds");
             if (creds == null || !creds.equals("test:test")) {
-                response.setStatusCode(HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED);
+                response.setCode(HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED);
             } else {
-                response.setStatusCode(HttpStatus.SC_OK);
+                response.setCode(HttpStatus.SC_OK);
                 final StringEntity entity = new StringEntity("success", StandardCharsets.US_ASCII);
                 response.setEntity(entity);
             }
@@ -663,10 +651,10 @@ public class TestClientAuthentication ex
         context.setCredentialsProvider(credsProvider);
 
         final HttpGet httpget = new HttpGet("/");
-        final HttpResponse response = this.httpclient.execute(target, httpget, context);
+        final ClassicHttpResponse response = this.httpclient.execute(target, httpget, context);
         final HttpEntity entity = response.getEntity();
         Assert.assertEquals(HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED,
-                response.getStatusLine().getStatusCode());
+                response.getCode());
         EntityUtils.consume(entity);
     }
 
@@ -674,14 +662,14 @@ public class TestClientAuthentication ex
 
         @Override
         public void handle(
-                final HttpRequest request,
-                final HttpResponse response,
+                final ClassicHttpRequest request,
+                final ClassicHttpResponse response,
                 final HttpContext context) throws HttpException, IOException {
             final String creds = (String) context.getAttribute("creds");
             if (creds == null || !creds.equals("test:test")) {
-                response.setStatusCode(HttpStatus.SC_UNAUTHORIZED);
+                response.setCode(HttpStatus.SC_UNAUTHORIZED);
             } else {
-                response.setStatusCode(HttpStatus.SC_OK);
+                response.setCode(HttpStatus.SC_OK);
                 final StringEntity entity = new StringEntity("success", StandardCharsets.US_ASCII);
                 response.setEntity(entity);
                 response.setHeader(HttpHeaders.CONNECTION, HeaderElements.CLOSE);
@@ -705,9 +693,9 @@ public class TestClientAuthentication ex
         for (int i = 0; i < 2; i++) {
             final HttpGet httpget = new HttpGet("/");
 
-            final HttpResponse response = this.httpclient.execute(target, httpget, context);
+            final ClassicHttpResponse response = this.httpclient.execute(target, httpget, context);
             EntityUtils.consume(response.getEntity());
-            Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
+            Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
         }
     }
 

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestClientAuthenticationFakeNTLM.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestClientAuthenticationFakeNTLM.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestClientAuthenticationFakeNTLM.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestClientAuthenticationFakeNTLM.java Tue Dec 27 19:48:07 2016
@@ -35,16 +35,14 @@ import org.apache.hc.client5.http.impl.s
 import org.apache.hc.client5.http.localserver.LocalServerTestBase;
 import org.apache.hc.client5.http.methods.HttpGet;
 import org.apache.hc.client5.http.protocol.HttpClientContext;
+import org.apache.hc.core5.http.ClassicHttpRequest;
+import org.apache.hc.core5.http.ClassicHttpResponse;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpHeaders;
 import org.apache.hc.core5.http.HttpHost;
-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.EntityUtils;
 import org.apache.hc.core5.http.io.HttpRequestHandler;
-import org.apache.hc.core5.http.message.BasicStatusLine;
+import org.apache.hc.core5.http.io.entity.EntityUtils;
 import org.apache.hc.core5.http.protocol.HttpContext;
 import org.junit.Assert;
 import org.junit.Test;
@@ -58,13 +56,10 @@ public class TestClientAuthenticationFak
 
         @Override
         public void handle(
-                final HttpRequest request,
-                final HttpResponse response,
+                final ClassicHttpRequest request,
+                final ClassicHttpResponse response,
                 final HttpContext context) throws HttpException, IOException {
-            response.setStatusLine(new BasicStatusLine(
-                    HttpVersion.HTTP_1_1,
-                    HttpStatus.SC_UNAUTHORIZED,
-                    "Authentication Required"));
+            response.setCode(HttpStatus.SC_UNAUTHORIZED);
             response.setHeader("Connection", "Keep-Alive");
             response.setHeader(HttpHeaders.WWW_AUTHENTICATE, "NTLM");
         }
@@ -87,10 +82,10 @@ public class TestClientAuthenticationFak
         final HttpContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("/");
 
-        final HttpResponse response = this.httpclient.execute(target, httpget, context);
+        final ClassicHttpResponse response = this.httpclient.execute(target, httpget, context);
         EntityUtils.consume(response.getEntity());
         Assert.assertEquals(HttpStatus.SC_UNAUTHORIZED,
-                response.getStatusLine().getStatusCode());
+                response.getCode());
     }
 
     static class NtlmType2MessageResponseHandler implements HttpRequestHandler {
@@ -103,13 +98,10 @@ public class TestClientAuthenticationFak
 
         @Override
         public void handle(
-                final HttpRequest request,
-                final HttpResponse response,
+                final ClassicHttpRequest request,
+                final ClassicHttpResponse response,
                 final HttpContext context) throws HttpException, IOException {
-            response.setStatusLine(new BasicStatusLine(
-                    HttpVersion.HTTP_1_1,
-                    HttpStatus.SC_UNAUTHORIZED,
-                    "Authentication Required"));
+            response.setCode(HttpStatus.SC_UNAUTHORIZED);
             response.setHeader("Connection", "Keep-Alive");
             if (!request.containsHeader(HttpHeaders.AUTHORIZATION)) {
                 response.setHeader(HttpHeaders.WWW_AUTHENTICATE, "NTLM");
@@ -137,10 +129,10 @@ public class TestClientAuthenticationFak
         final HttpContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("/");
 
-        final HttpResponse response = this.httpclient.execute(target, httpget, context);
+        final ClassicHttpResponse response = this.httpclient.execute(target, httpget, context);
         EntityUtils.consume(response.getEntity());
         Assert.assertEquals(HttpStatus.SC_UNAUTHORIZED,
-                response.getStatusLine().getStatusCode());
+                response.getCode());
     }
 
     @Test
@@ -161,10 +153,10 @@ public class TestClientAuthenticationFak
         final HttpContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("/");
 
-        final HttpResponse response = this.httpclient.execute(target, httpget, context);
+        final ClassicHttpResponse response = this.httpclient.execute(target, httpget, context);
         EntityUtils.consume(response.getEntity());
         Assert.assertEquals(HttpStatus.SC_UNAUTHORIZED,
-                response.getStatusLine().getStatusCode());
+                response.getCode());
     }
 
     static class NtlmType2MessageOnlyResponseHandler implements HttpRequestHandler {
@@ -177,13 +169,10 @@ public class TestClientAuthenticationFak
 
         @Override
         public void handle(
-                final HttpRequest request,
-                final HttpResponse response,
+                final ClassicHttpRequest request,
+                final ClassicHttpResponse response,
                 final HttpContext context) throws HttpException, IOException {
-            response.setStatusLine(new BasicStatusLine(
-                    HttpVersion.HTTP_1_1,
-                    HttpStatus.SC_UNAUTHORIZED,
-                    "Authentication Required"));
+            response.setCode(HttpStatus.SC_UNAUTHORIZED);
             response.setHeader("Connection", "Keep-Alive");
             response.setHeader(HttpHeaders.WWW_AUTHENTICATE, authenticateHeaderValue);
         }
@@ -204,10 +193,10 @@ public class TestClientAuthenticationFak
         context.setCredentialsProvider(credsProvider);
         final HttpGet httpget = new HttpGet("/");
 
-        final HttpResponse response = this.httpclient.execute(target, httpget, context);
+        final ClassicHttpResponse response = this.httpclient.execute(target, httpget, context);
         EntityUtils.consume(response.getEntity());
         Assert.assertEquals(HttpStatus.SC_UNAUTHORIZED,
-                response.getStatusLine().getStatusCode());
+                response.getCode());
     }
 
     @Test
@@ -225,10 +214,10 @@ public class TestClientAuthenticationFak
         context.setCredentialsProvider(credsProvider);
         final HttpGet httpget = new HttpGet("/");
 
-        final HttpResponse response = this.httpclient.execute(target, httpget, context);
+        final ClassicHttpResponse response = this.httpclient.execute(target, httpget, context);
         EntityUtils.consume(response.getEntity());
         Assert.assertEquals(HttpStatus.SC_UNAUTHORIZED,
-                response.getStatusLine().getStatusCode());
+                response.getCode());
     }
 
 }

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestClientAuthenticationFallBack.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestClientAuthenticationFallBack.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestClientAuthenticationFallBack.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestClientAuthenticationFallBack.java Tue Dec 27 19:48:07 2016
@@ -37,24 +37,22 @@ import org.apache.hc.client5.http.locals
 import org.apache.hc.client5.http.localserver.RequestBasicAuth;
 import org.apache.hc.client5.http.methods.HttpGet;
 import org.apache.hc.client5.http.protocol.HttpClientContext;
+import org.apache.hc.core5.http.ClassicHttpRequest;
+import org.apache.hc.core5.http.ClassicHttpResponse;
+import org.apache.hc.core5.http.EntityDetails;
 import org.apache.hc.core5.http.HttpEntity;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpHeaders;
 import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpResponse;
 import org.apache.hc.core5.http.HttpResponseInterceptor;
 import org.apache.hc.core5.http.HttpStatus;
-import org.apache.hc.core5.http.entity.EntityUtils;
-import org.apache.hc.core5.http.entity.StringEntity;
+import org.apache.hc.core5.http.impl.HttpProcessors;
 import org.apache.hc.core5.http.io.HttpRequestHandler;
+import org.apache.hc.core5.http.io.entity.EntityUtils;
+import org.apache.hc.core5.http.io.entity.StringEntity;
 import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.http.protocol.HttpProcessor;
-import org.apache.hc.core5.http.protocol.HttpProcessorBuilder;
-import org.apache.hc.core5.http.protocol.ResponseConnControl;
-import org.apache.hc.core5.http.protocol.ResponseContent;
-import org.apache.hc.core5.http.protocol.ResponseDate;
-import org.apache.hc.core5.http.protocol.ResponseServer;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -66,8 +64,9 @@ public class TestClientAuthenticationFal
         @Override
         public void process(
                 final HttpResponse response,
+                final EntityDetails entityDetails,
                 final HttpContext context) throws HttpException, IOException {
-            if (response.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
+            if (response.getCode() == HttpStatus.SC_UNAUTHORIZED) {
                 response.addHeader(HttpHeaders.WWW_AUTHENTICATE, "Digest realm=\"test realm\" invalid");
                 response.addHeader(HttpHeaders.WWW_AUTHENTICATE, "Basic realm=\"test realm\"");
             }
@@ -78,11 +77,7 @@ public class TestClientAuthenticationFal
     @Before @Override
     public void setUp() throws Exception {
         super.setUp();
-        final HttpProcessor httpproc = HttpProcessorBuilder.create()
-            .add(new ResponseDate())
-            .add(new ResponseServer(LocalServerTestBase.ORIGIN))
-            .add(new ResponseContent())
-            .add(new ResponseConnControl())
+        final HttpProcessor httpproc = HttpProcessors.customServer(null)
             .add(new RequestBasicAuth())
             .add(new ResponseBasicUnauthorized()).build();
         this.serverBootstrap.setHttpProcessor(httpproc);
@@ -92,14 +87,14 @@ public class TestClientAuthenticationFal
 
         @Override
         public void handle(
-                final HttpRequest request,
-                final HttpResponse response,
+                final ClassicHttpRequest request,
+                final ClassicHttpResponse response,
                 final HttpContext context) throws HttpException, IOException {
             final String creds = (String) context.getAttribute("creds");
             if (creds == null || !creds.equals("test:test")) {
-                response.setStatusCode(HttpStatus.SC_UNAUTHORIZED);
+                response.setCode(HttpStatus.SC_UNAUTHORIZED);
             } else {
-                response.setStatusCode(HttpStatus.SC_OK);
+                response.setCode(HttpStatus.SC_OK);
                 final StringEntity entity = new StringEntity("success", StandardCharsets.US_ASCII);
                 response.setEntity(entity);
             }
@@ -141,9 +136,9 @@ public class TestClientAuthenticationFal
         context.setCredentialsProvider(credsProvider);
         final HttpGet httpget = new HttpGet("/");
 
-        final HttpResponse response = this.httpclient.execute(target, httpget, context);
+        final ClassicHttpResponse response = this.httpclient.execute(target, httpget, context);
         final HttpEntity entity = response.getEntity();
-        Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
+        Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
         Assert.assertNotNull(entity);
         EntityUtils.consume(entity);
         final AuthScope authscope = credsProvider.getAuthScope();

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestClientReauthentication.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestClientReauthentication.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestClientReauthentication.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestClientReauthentication.java Tue Dec 27 19:48:07 2016
@@ -42,29 +42,27 @@ import org.apache.hc.client5.http.impl.a
 import org.apache.hc.client5.http.impl.auth.BasicSchemeFactory;
 import org.apache.hc.client5.http.localserver.LocalServerTestBase;
 import org.apache.hc.client5.http.localserver.RequestBasicAuth;
-import org.apache.hc.client5.http.methods.CloseableHttpResponse;
+import org.apache.hc.client5.http.impl.sync.CloseableHttpResponse;
 import org.apache.hc.client5.http.methods.HttpGet;
 import org.apache.hc.client5.http.protocol.HttpClientContext;
+import org.apache.hc.core5.http.ClassicHttpRequest;
+import org.apache.hc.core5.http.ClassicHttpResponse;
+import org.apache.hc.core5.http.EntityDetails;
 import org.apache.hc.core5.http.HttpEntity;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpHeaders;
 import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpResponse;
 import org.apache.hc.core5.http.HttpResponseInterceptor;
 import org.apache.hc.core5.http.HttpStatus;
 import org.apache.hc.core5.http.config.Registry;
 import org.apache.hc.core5.http.config.RegistryBuilder;
-import org.apache.hc.core5.http.entity.EntityUtils;
-import org.apache.hc.core5.http.entity.StringEntity;
+import org.apache.hc.core5.http.impl.HttpProcessors;
 import org.apache.hc.core5.http.io.HttpRequestHandler;
+import org.apache.hc.core5.http.io.entity.EntityUtils;
+import org.apache.hc.core5.http.io.entity.StringEntity;
 import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.http.protocol.HttpProcessor;
-import org.apache.hc.core5.http.protocol.HttpProcessorBuilder;
-import org.apache.hc.core5.http.protocol.ResponseConnControl;
-import org.apache.hc.core5.http.protocol.ResponseContent;
-import org.apache.hc.core5.http.protocol.ResponseDate;
-import org.apache.hc.core5.http.protocol.ResponseServer;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -76,8 +74,9 @@ public class TestClientReauthentication
         @Override
         public void process(
                 final HttpResponse response,
+                final EntityDetails entityDetails,
                 final HttpContext context) throws HttpException, IOException {
-            if (response.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
+            if (response.getCode() == HttpStatus.SC_UNAUTHORIZED) {
                 response.addHeader(HttpHeaders.WWW_AUTHENTICATE, "MyBasic realm=\"test realm\"");
             }
         }
@@ -87,11 +86,7 @@ public class TestClientReauthentication
     @Before @Override
     public void setUp() throws Exception {
         super.setUp();
-        final HttpProcessor httpproc = HttpProcessorBuilder.create()
-            .add(new ResponseDate())
-            .add(new ResponseServer(LocalServerTestBase.ORIGIN))
-            .add(new ResponseContent())
-            .add(new ResponseConnControl())
+        final HttpProcessor httpproc = HttpProcessors.customServer(null)
             .add(new RequestBasicAuth())
             .add(new ResponseBasicUnauthorized()).build();
         this.serverBootstrap.setHttpProcessor(httpproc);
@@ -103,18 +98,18 @@ public class TestClientReauthentication
 
         @Override
         public void handle(
-                final HttpRequest request,
-                final HttpResponse response,
+                final ClassicHttpRequest request,
+                final ClassicHttpResponse response,
                 final HttpContext context) throws HttpException, IOException {
             final String creds = (String) context.getAttribute("creds");
             if (creds == null || !creds.equals("test:test")) {
-                response.setStatusCode(HttpStatus.SC_UNAUTHORIZED);
+                response.setCode(HttpStatus.SC_UNAUTHORIZED);
             } else {
                 // Make client re-authenticate on each fourth request
                 if (this.count.incrementAndGet() % 4 == 0) {
-                    response.setStatusCode(HttpStatus.SC_UNAUTHORIZED);
+                    response.setCode(HttpStatus.SC_UNAUTHORIZED);
                 } else {
-                    response.setStatusCode(HttpStatus.SC_OK);
+                    response.setCode(HttpStatus.SC_OK);
                     final StringEntity entity = new StringEntity("success", StandardCharsets.US_ASCII);
                     response.setEntity(entity);
                 }
@@ -184,7 +179,7 @@ public class TestClientReauthentication
             httpget.setConfig(config);
             try (final CloseableHttpResponse response = this.httpclient.execute(target, httpget, context)) {
                 final HttpEntity entity = response.getEntity();
-                Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
+                Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
                 Assert.assertNotNull(entity);
                 EntityUtils.consume(entity);
             }

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestClientRequestExecution.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestClientRequestExecution.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestClientRequestExecution.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestClientRequestExecution.java Tue Dec 27 19:48:07 2016
@@ -38,23 +38,25 @@ import org.apache.hc.client5.http.protoc
 import org.apache.hc.client5.http.protocol.HttpClientContext;
 import org.apache.hc.client5.http.protocol.NonRepeatableRequestException;
 import org.apache.hc.client5.http.sync.HttpRequestRetryHandler;
-import org.apache.hc.client5.http.utils.URIBuilder;
 import org.apache.hc.client5.http.utils.URIUtils;
+import org.apache.hc.core5.http.ClassicHttpRequest;
+import org.apache.hc.core5.http.ClassicHttpResponse;
+import org.apache.hc.core5.http.EntityDetails;
 import org.apache.hc.core5.http.Header;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpHost;
 import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpRequestInterceptor;
-import org.apache.hc.core5.http.HttpResponse;
 import org.apache.hc.core5.http.HttpStatus;
-import org.apache.hc.core5.http.entity.EntityUtils;
-import org.apache.hc.core5.http.entity.InputStreamEntity;
-import org.apache.hc.core5.http.entity.StringEntity;
 import org.apache.hc.core5.http.impl.io.HttpRequestExecutor;
 import org.apache.hc.core5.http.io.HttpClientConnection;
 import org.apache.hc.core5.http.io.HttpRequestHandler;
-import org.apache.hc.core5.http.message.BasicHttpRequest;
+import org.apache.hc.core5.http.io.entity.EntityUtils;
+import org.apache.hc.core5.http.io.entity.InputStreamEntity;
+import org.apache.hc.core5.http.io.entity.StringEntity;
+import org.apache.hc.core5.http.message.BasicClassicHttpRequest;
 import org.apache.hc.core5.http.protocol.HttpContext;
+import org.apache.hc.core5.net.URIBuilder;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -71,10 +73,10 @@ public class TestClientRequestExecution
 
         @Override
         public void handle(
-                final HttpRequest request,
-                final HttpResponse response,
+                final ClassicHttpRequest request,
+                final ClassicHttpResponse response,
                 final HttpContext context) throws HttpException, IOException {
-            response.setStatusCode(HttpStatus.SC_OK);
+            response.setCode(HttpStatus.SC_OK);
             final StringEntity entity = new StringEntity("Whatever");
             response.setEntity(entity);
         }
@@ -91,12 +93,12 @@ public class TestClientRequestExecution
         }
 
         @Override
-        public HttpResponse execute(
-                final HttpRequest request,
+        public ClassicHttpResponse execute(
+                final ClassicHttpRequest request,
                 final HttpClientConnection conn,
                 final HttpContext context) throws IOException, HttpException {
 
-            final HttpResponse response = super.execute(request, conn, context);
+            final ClassicHttpResponse response = super.execute(request, conn, context);
             final Object marker = context.getAttribute(MARKER);
             if (marker == null) {
                 context.setAttribute(MARKER, Boolean.TRUE);
@@ -116,6 +118,7 @@ public class TestClientRequestExecution
             @Override
             public void process(
                     final HttpRequest request,
+                    final EntityDetails entityDetails,
                     final HttpContext context) throws HttpException, IOException {
                 request.addHeader("my-header", "stuff");
             }
@@ -147,12 +150,12 @@ public class TestClientRequestExecution
 
         final HttpGet httpget = new HttpGet("/");
 
-        final HttpResponse response = this.httpclient.execute(target, httpget, context);
+        final ClassicHttpResponse response = this.httpclient.execute(target, httpget, context);
         EntityUtils.consume(response.getEntity());
 
         final HttpRequest reqWrapper = context.getRequest();
 
-        Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
+        Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
 
         final Header[] myheaders = reqWrapper.getHeaders("my-header");
         Assert.assertNotNull(myheaders);
@@ -209,15 +212,15 @@ public class TestClientRequestExecution
         final HttpHost target = start();
 
         final HttpClientContext context = HttpClientContext.create();
-        final BasicHttpRequest request = new BasicHttpRequest("GET", "blah.:.blah.:.");
-        final HttpResponse response = this.httpclient.execute(target, request, context);
+        final ClassicHttpRequest request = new BasicClassicHttpRequest("GET", "blah.:.blah.:.");
+        final ClassicHttpResponse response = this.httpclient.execute(target, request, context);
         EntityUtils.consume(response.getEntity());
 
-        Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
+        Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
 
         final HttpRequest reqWrapper = context.getRequest();
 
-        Assert.assertEquals("blah.:.blah.:.", reqWrapper.getRequestLine().getUri());
+        Assert.assertEquals("blah.:.blah.:.", reqWrapper.getRequestUri());
     }
 
     @Test
@@ -229,12 +232,12 @@ public class TestClientRequestExecution
         final HttpGet httpget = new HttpGet("/stuff#blahblah");
         final HttpClientContext context = HttpClientContext.create();
 
-        final HttpResponse response = this.httpclient.execute(target, httpget, context);
-        Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
+        final ClassicHttpResponse response = this.httpclient.execute(target, httpget, context);
+        Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
         EntityUtils.consume(response.getEntity());
 
         final HttpRequest request = context.getRequest();
-        Assert.assertEquals("/stuff", request.getRequestLine().getUri());
+        Assert.assertEquals("/stuff", request.getRequestUri());
     }
 
     @Test
@@ -254,12 +257,12 @@ public class TestClientRequestExecution
         final HttpGet httpget = new HttpGet(uri);
         final HttpClientContext context = HttpClientContext.create();
 
-        final HttpResponse response = this.httpclient.execute(httpget, context);
-        Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
+        final ClassicHttpResponse response = this.httpclient.execute(httpget, context);
+        Assert.assertEquals(HttpStatus.SC_OK, response.getCode());
         EntityUtils.consume(response.getEntity());
 
         final HttpRequest request = context.getRequest();
-        Assert.assertEquals("/stuff", request.getRequestLine().getUri());
+        Assert.assertEquals("/stuff", request.getRequestUri());
 
         final List<URI> redirectLocations = context.getRedirectLocations();
         final URI location = URIUtils.resolve(uri, target, redirectLocations);

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestConnectionAutoRelease.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestConnectionAutoRelease.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestConnectionAutoRelease.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestConnectionAutoRelease.java Tue Dec 27 19:48:07 2016
@@ -37,17 +37,17 @@ import org.apache.hc.client5.http.HttpRo
 import org.apache.hc.client5.http.io.ConnectionRequest;
 import org.apache.hc.client5.http.localserver.LocalServerTestBase;
 import org.apache.hc.client5.http.methods.HttpGet;
+import org.apache.hc.core5.http.ClassicHttpRequest;
+import org.apache.hc.core5.http.ClassicHttpResponse;
 import org.apache.hc.core5.http.HttpEntity;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.http.HttpRequest;
-import org.apache.hc.core5.http.HttpResponse;
 import org.apache.hc.core5.http.MalformedChunkCodingException;
-import org.apache.hc.core5.http.entity.BasicHttpEntity;
-import org.apache.hc.core5.http.entity.EntityUtils;
 import org.apache.hc.core5.http.impl.io.DefaultBHttpServerConnection;
 import org.apache.hc.core5.http.io.HttpClientConnection;
 import org.apache.hc.core5.http.io.HttpRequestHandler;
+import org.apache.hc.core5.http.io.entity.BasicHttpEntity;
+import org.apache.hc.core5.http.io.entity.EntityUtils;
 import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.http.protocol.HttpCoreContext;
 import org.apache.hc.core5.pool.PoolStats;
@@ -68,7 +68,7 @@ public class TestConnectionAutoRelease e
         final HttpHost target = start();
         // Get some random data
         final HttpGet httpget = new HttpGet("/random/20000");
-        final HttpResponse response = this.httpclient.execute(target, httpget);
+        final ClassicHttpResponse response = this.httpclient.execute(target, httpget);
 
         ConnectionRequest connreq = this.connManager.requestConnection(new HttpRoute(target), null);
         try {
@@ -104,7 +104,7 @@ public class TestConnectionAutoRelease e
         final HttpHost target = start();
         // Get some random data
         final HttpGet httpget = new HttpGet("/random/20000");
-        final HttpResponse response = this.httpclient.execute(target, httpget);
+        final ClassicHttpResponse response = this.httpclient.execute(target, httpget);
 
         ConnectionRequest connreq = this.connManager.requestConnection(new HttpRoute(target), null);
         try {
@@ -142,7 +142,7 @@ public class TestConnectionAutoRelease e
 
         // Get some random data
         final HttpGet httpget = new HttpGet("/random/20000");
-        final HttpResponse response = this.httpclient.execute(target, httpget);
+        final ClassicHttpResponse response = this.httpclient.execute(target, httpget);
 
         ConnectionRequest connreq = this.connManager.requestConnection(new HttpRoute(target), null);
         try {
@@ -171,8 +171,8 @@ public class TestConnectionAutoRelease e
 
             @Override
             public void handle(
-                    final HttpRequest request,
-                    final HttpResponse response,
+                    final ClassicHttpRequest request,
+                    final ClassicHttpResponse response,
                     final HttpContext context) throws HttpException, IOException {
                 final BasicHttpEntity entity = new BasicHttpEntity() {
 
@@ -210,7 +210,7 @@ public class TestConnectionAutoRelease e
 
         // Get some random data
         final HttpGet httpget = new HttpGet("/dropdead");
-        final HttpResponse response = this.httpclient.execute(target, httpget);
+        final ClassicHttpResponse response = this.httpclient.execute(target, httpget);
 
         ConnectionRequest connreq = this.connManager.requestConnection(new HttpRoute(target), null);
         try {

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestConnectionManagement.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestConnectionManagement.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestConnectionManagement.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestConnectionManagement.java Tue Dec 27 19:48:07 2016
@@ -27,15 +27,9 @@
 
 package org.apache.hc.client5.http.impl.integration;
 
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.net.SocketException;
 import java.util.Collections;
-import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
 
 import org.apache.hc.client5.http.ConnectionPoolTimeoutException;
 import org.apache.hc.client5.http.HttpRoute;
@@ -43,24 +37,19 @@ import org.apache.hc.client5.http.impl.i
 import org.apache.hc.client5.http.io.ConnectionRequest;
 import org.apache.hc.client5.http.io.HttpClientConnectionManager;
 import org.apache.hc.client5.http.localserver.LocalServerTestBase;
-import org.apache.hc.client5.http.socket.ConnectionSocketFactory;
-import org.apache.hc.client5.http.socket.PlainConnectionSocketFactory;
+import org.apache.hc.core5.http.ClassicHttpRequest;
+import org.apache.hc.core5.http.ClassicHttpResponse;
 import org.apache.hc.core5.http.HttpHost;
-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.config.Registry;
-import org.apache.hc.core5.http.config.RegistryBuilder;
-import org.apache.hc.core5.http.entity.EntityUtils;
 import org.apache.hc.core5.http.impl.io.HttpRequestExecutor;
 import org.apache.hc.core5.http.io.HttpClientConnection;
-import org.apache.hc.core5.http.message.BasicHttpRequest;
+import org.apache.hc.core5.http.io.entity.EntityUtils;
+import org.apache.hc.core5.http.message.BasicClassicHttpRequest;
 import org.apache.hc.core5.http.protocol.BasicHttpContext;
+import org.apache.hc.core5.http.protocol.DefaultHttpProcessor;
 import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.http.protocol.HttpCoreContext;
 import org.apache.hc.core5.http.protocol.HttpProcessor;
-import org.apache.hc.core5.http.protocol.ImmutableHttpProcessor;
 import org.apache.hc.core5.http.protocol.RequestConnControl;
 import org.apache.hc.core5.http.protocol.RequestContent;
 import org.apache.hc.core5.http.protocol.RequestTargetHost;
@@ -102,7 +91,7 @@ public class TestConnectionManagement ex
         final int      rsplen = 8;
         final String      uri = "/random/" + rsplen;
 
-        final HttpRequest request = new BasicHttpRequest("GET", uri, HttpVersion.HTTP_1_1);
+        final ClassicHttpRequest request = new BasicClassicHttpRequest("GET", uri);
         final HttpContext context = new BasicHttpContext();
 
         HttpClientConnection conn = getConnection(this.connManager, route);
@@ -110,18 +99,17 @@ public class TestConnectionManagement ex
         this.connManager.routeComplete(conn, route, context);
 
         context.setAttribute(HttpCoreContext.HTTP_CONNECTION, conn);
-        context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, target);
 
-        final HttpProcessor httpProcessor = new ImmutableHttpProcessor(
+        final HttpProcessor httpProcessor = new DefaultHttpProcessor(
                 new RequestTargetHost(), new RequestContent(), new RequestConnControl());
 
         final HttpRequestExecutor exec = new HttpRequestExecutor();
         exec.preProcess(request, httpProcessor, context);
-        HttpResponse response = exec.execute(request, conn, context);
+        ClassicHttpResponse response = exec.execute(request, conn, context);
 
         Assert.assertEquals("wrong status in first response",
                      HttpStatus.SC_OK,
-                     response.getStatusLine().getStatusCode());
+                     response.getCode());
         byte[] data = EntityUtils.toByteArray(response.getEntity());
         Assert.assertEquals("wrong length of first response entity",
                      rsplen, data.length);
@@ -150,7 +138,7 @@ public class TestConnectionManagement ex
 
         Assert.assertEquals("wrong status in second response",
                      HttpStatus.SC_OK,
-                     response.getStatusLine().getStatusCode());
+                     response.getCode());
         data = EntityUtils.toByteArray(response.getEntity());
         Assert.assertEquals("wrong length of second response entity",
                      rsplen, data.length);
@@ -168,7 +156,7 @@ public class TestConnectionManagement ex
 
         Assert.assertEquals("wrong status in third response",
                      HttpStatus.SC_OK,
-                     response.getStatusLine().getStatusCode());
+                     response.getCode());
         data = EntityUtils.toByteArray(response.getEntity());
         Assert.assertEquals("wrong length of third response entity",
                      rsplen, data.length);
@@ -191,7 +179,7 @@ public class TestConnectionManagement ex
         final int      rsplen = 8;
         final String      uri = "/random/" + rsplen;
 
-        final HttpRequest request = new BasicHttpRequest("GET", uri, HttpVersion.HTTP_1_1);
+        final ClassicHttpRequest request = new BasicClassicHttpRequest("GET", uri);
         final HttpContext context = new BasicHttpContext();
 
         HttpClientConnection conn = getConnection(this.connManager, route);
@@ -199,18 +187,17 @@ public class TestConnectionManagement ex
         this.connManager.routeComplete(conn, route, context);
 
         context.setAttribute(HttpCoreContext.HTTP_CONNECTION, conn);
-        context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, target);
 
-        final HttpProcessor httpProcessor = new ImmutableHttpProcessor(
+        final HttpProcessor httpProcessor = new DefaultHttpProcessor(
                 new RequestTargetHost(), new RequestContent(), new RequestConnControl());
 
         final HttpRequestExecutor exec = new HttpRequestExecutor();
         exec.preProcess(request, httpProcessor, context);
-        HttpResponse response = exec.execute(request, conn, context);
+        ClassicHttpResponse response = exec.execute(request, conn, context);
 
         Assert.assertEquals("wrong status in first response",
                      HttpStatus.SC_OK,
-                     response.getStatusLine().getStatusCode());
+                     response.getCode());
         byte[] data = EntityUtils.toByteArray(response.getEntity());
         Assert.assertEquals("wrong length of first response entity",
                      rsplen, data.length);
@@ -239,7 +226,7 @@ public class TestConnectionManagement ex
 
         Assert.assertEquals("wrong status in second response",
                      HttpStatus.SC_OK,
-                     response.getStatusLine().getStatusCode());
+                     response.getCode());
         data = EntityUtils.toByteArray(response.getEntity());
         Assert.assertEquals("wrong length of second response entity",
                      rsplen, data.length);
@@ -255,7 +242,7 @@ public class TestConnectionManagement ex
 
         Assert.assertEquals("wrong status in third response",
                      HttpStatus.SC_OK,
-                     response.getStatusLine().getStatusCode());
+                     response.getCode());
         data = EntityUtils.toByteArray(response.getEntity());
         Assert.assertEquals("wrong length of third response entity",
                      rsplen, data.length);
@@ -275,7 +262,7 @@ public class TestConnectionManagement ex
 
         Assert.assertEquals("wrong status in third response",
                      HttpStatus.SC_OK,
-                     response.getStatusLine().getStatusCode());
+                     response.getCode());
         data = EntityUtils.toByteArray(response.getEntity());
         Assert.assertEquals("wrong length of fourth response entity",
                      rsplen, data.length);
@@ -308,7 +295,7 @@ public class TestConnectionManagement ex
         Assert.assertEquals(1, this.connManager.getTotalStats().getAvailable());
         Assert.assertEquals(1, this.connManager.getStats(route).getAvailable());
 
-        this.connManager.closeExpiredConnections();
+        this.connManager.closeExpired();
 
         // Time has not expired yet.
         Assert.assertEquals(Collections.singleton(route), this.connManager.getRoutes());
@@ -317,7 +304,7 @@ public class TestConnectionManagement ex
 
         Thread.sleep(150);
 
-        this.connManager.closeExpiredConnections();
+        this.connManager.closeExpired();
 
         // Time expired now, connections are destroyed.
         Assert.assertEquals(Collections.emptySet(), this.connManager.getRoutes());
@@ -355,7 +342,7 @@ public class TestConnectionManagement ex
         Assert.assertEquals(1, this.connManager.getTotalStats().getAvailable());
         Assert.assertEquals(1, this.connManager.getStats(route).getAvailable());
 
-        this.connManager.closeExpiredConnections();
+        this.connManager.closeExpired();
 
         // Time has not expired yet.
         Assert.assertEquals(Collections.singleton(route), this.connManager.getRoutes());
@@ -364,7 +351,7 @@ public class TestConnectionManagement ex
 
         Thread.sleep(150);
 
-        this.connManager.closeExpiredConnections();
+        this.connManager.closeExpired();
 
         // TTL expired now, connections are destroyed.
         Assert.assertEquals(Collections.emptySet(), this.connManager.getRoutes());
@@ -389,26 +376,25 @@ public class TestConnectionManagement ex
         final String      uri = "/random/" + rsplen;
         final HttpContext context = new BasicHttpContext();
 
-        final HttpRequest request =
-            new BasicHttpRequest("GET", uri, HttpVersion.HTTP_1_1);
+        final ClassicHttpRequest request =
+            new BasicClassicHttpRequest("GET", uri);
 
         HttpClientConnection conn = getConnection(this.connManager, route);
         this.connManager.connect(conn, route, 0, context);
         this.connManager.routeComplete(conn, route, context);
 
         context.setAttribute(HttpCoreContext.HTTP_CONNECTION, conn);
-        context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, target);
 
-        final HttpProcessor httpProcessor = new ImmutableHttpProcessor(
+        final HttpProcessor httpProcessor = new DefaultHttpProcessor(
                 new RequestTargetHost(), new RequestContent(), new RequestConnControl());
 
         final HttpRequestExecutor exec = new HttpRequestExecutor();
         exec.preProcess(request, httpProcessor, context);
-        final HttpResponse response = exec.execute(request, conn, context);
+        final ClassicHttpResponse response = exec.execute(request, conn, context);
 
         Assert.assertEquals("wrong status in first response",
                      HttpStatus.SC_OK,
-                     response.getStatusLine().getStatusCode());
+                     response.getCode());
 
         // check that there are no connections available
         try {
@@ -432,253 +418,4 @@ public class TestConnectionManagement ex
         this.connManager.shutdown();
     }
 
-    @Test
-    public void testAbortDuringConnecting() throws Exception {
-        final CountDownLatch connectLatch = new CountDownLatch(1);
-        final StallingSocketFactory stallingSocketFactory = new StallingSocketFactory(
-                connectLatch, WaitPolicy.BEFORE_CONNECT, PlainConnectionSocketFactory.getSocketFactory());
-        final Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create()
-            .register("http", stallingSocketFactory)
-            .build();
-
-        this.connManager = new PoolingHttpClientConnectionManager(registry);
-        this.clientBuilder.setConnectionManager(this.connManager);
-
-        this.connManager.setMaxTotal(1);
-
-        final HttpHost target = start();
-        final HttpRoute route = new HttpRoute(target, null, false);
-        final HttpContext context = new BasicHttpContext();
-
-        final HttpClientConnection conn = getConnection(this.connManager, route);
-
-        final AtomicReference<Throwable> throwRef = new AtomicReference<>();
-        final Thread abortingThread = new Thread(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    stallingSocketFactory.waitForState();
-                    conn.shutdown();
-                    connManager.releaseConnection(conn, null, -1, null);
-                    connectLatch.countDown();
-                } catch (final Throwable e) {
-                    throwRef.set(e);
-                }
-            }
-        });
-        abortingThread.start();
-
-        try {
-            this.connManager.connect(conn, route, 0, context);
-            this.connManager.routeComplete(conn, route, context);
-            Assert.fail("expected SocketException");
-        } catch(final SocketException expected) {}
-
-        abortingThread.join(5000);
-        if(throwRef.get() != null) {
-            throw new RuntimeException(throwRef.get());
-        }
-
-        Assert.assertFalse(conn.isOpen());
-
-        // the connection is expected to be released back to the manager
-        final HttpClientConnection conn2 = getConnection(this.connManager, route, 5L, TimeUnit.SECONDS);
-        Assert.assertFalse("connection should have been closed", conn2.isOpen());
-
-        this.connManager.releaseConnection(conn2, null, -1, null);
-        this.connManager.shutdown();
-    }
-
-    @Test
-    public void testAbortBeforeSocketCreate() throws Exception {
-        final CountDownLatch connectLatch = new CountDownLatch(1);
-        final StallingSocketFactory stallingSocketFactory = new StallingSocketFactory(
-                connectLatch, WaitPolicy.BEFORE_CREATE, PlainConnectionSocketFactory.getSocketFactory());
-        final Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create()
-            .register("http", stallingSocketFactory)
-            .build();
-
-        this.connManager = new PoolingHttpClientConnectionManager(registry);
-        this.clientBuilder.setConnectionManager(this.connManager);
-
-        this.connManager.setMaxTotal(1);
-
-        final HttpHost target = start();
-        final HttpRoute route = new HttpRoute(target, null, false);
-        final HttpContext context = new BasicHttpContext();
-
-        final HttpClientConnection conn = getConnection(this.connManager, route);
-
-        final AtomicReference<Throwable> throwRef = new AtomicReference<>();
-        final Thread abortingThread = new Thread(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    stallingSocketFactory.waitForState();
-                    conn.shutdown();
-                    connManager.releaseConnection(conn, null, -1, null);
-                    connectLatch.countDown();
-                } catch (final Throwable e) {
-                    throwRef.set(e);
-                }
-            }
-        });
-        abortingThread.start();
-
-        try {
-            this.connManager.connect(conn, route, 0, context);
-            this.connManager.routeComplete(conn, route, context);
-            Assert.fail("IOException expected");
-        } catch(final IOException expected) {
-        }
-
-        abortingThread.join(5000);
-        if(throwRef.get() != null) {
-            throw new RuntimeException(throwRef.get());
-        }
-
-        Assert.assertFalse(conn.isOpen());
-
-        // the connection is expected to be released back to the manager
-        final HttpClientConnection conn2 = getConnection(this.connManager, route, 5L, TimeUnit.SECONDS);
-        Assert.assertFalse("connection should have been closed", conn2.isOpen());
-
-        this.connManager.releaseConnection(conn2, null, -1, null);
-        this.connManager.shutdown();
-    }
-
-    @Test
-    public void testAbortAfterSocketConnect() throws Exception {
-        final CountDownLatch connectLatch = new CountDownLatch(1);
-        final StallingSocketFactory stallingSocketFactory = new StallingSocketFactory(
-                connectLatch, WaitPolicy.AFTER_CONNECT, PlainConnectionSocketFactory.getSocketFactory());
-        final Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create()
-            .register("http", stallingSocketFactory)
-            .build();
-
-        this.connManager = new PoolingHttpClientConnectionManager(registry);
-        this.clientBuilder.setConnectionManager(this.connManager);
-
-        this.connManager.setMaxTotal(1);
-
-        final HttpHost target = start();
-        final HttpRoute route = new HttpRoute(target, null, false);
-        final HttpContext context = new BasicHttpContext();
-
-        final HttpClientConnection conn = getConnection(this.connManager, route);
-
-        final AtomicReference<Throwable> throwRef = new AtomicReference<>();
-        final Thread abortingThread = new Thread(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    stallingSocketFactory.waitForState();
-                    conn.shutdown();
-                    connManager.releaseConnection(conn, null, -1, null);
-                    connectLatch.countDown();
-                } catch (final Throwable e) {
-                    throwRef.set(e);
-                }
-            }
-        });
-        abortingThread.start();
-
-        try {
-            this.connManager.connect(conn, route, 0, context);
-            this.connManager.routeComplete(conn, route, context);
-            Assert.fail("IOException expected");
-        } catch(final IOException expected) {
-        }
-
-        abortingThread.join(5000);
-        if(throwRef.get() != null) {
-            throw new RuntimeException(throwRef.get());
-        }
-
-        Assert.assertFalse(conn.isOpen());
-
-        // the connection is expected to be released back to the manager
-        final HttpClientConnection conn2 = getConnection(this.connManager, route, 5L, TimeUnit.SECONDS);
-        Assert.assertFalse("connection should have been closed", conn2.isOpen());
-
-        this.connManager.releaseConnection(conn2, null, -1, null);
-        this.connManager.shutdown();
-    }
-
-    static class LatchSupport {
-
-        private final CountDownLatch continueLatch;
-        private final CountDownLatch waitLatch = new CountDownLatch(1);
-        protected final WaitPolicy waitPolicy;
-
-        LatchSupport(final CountDownLatch continueLatch, final WaitPolicy waitPolicy) {
-            this.continueLatch = continueLatch;
-            this.waitPolicy = waitPolicy;
-        }
-
-        void waitForState() throws InterruptedException {
-            if(!waitLatch.await(1, TimeUnit.SECONDS)) {
-                throw new RuntimeException("waited too long");
-            }
-        }
-
-        void latch() {
-            waitLatch.countDown();
-            try {
-                if (!continueLatch.await(60, TimeUnit.SECONDS)) {
-                    throw new RuntimeException("waited too long!");
-                }
-            } catch (final InterruptedException e) {
-                throw new RuntimeException(e);
-            }
-        }
-    }
-
-    private static class StallingSocketFactory extends LatchSupport implements ConnectionSocketFactory {
-
-        private final ConnectionSocketFactory delegate;
-
-        public StallingSocketFactory(
-                final CountDownLatch continueLatch,
-                final WaitPolicy waitPolicy,
-                final ConnectionSocketFactory delegate) {
-            super(continueLatch, waitPolicy);
-            this.delegate = delegate;
-        }
-
-        @Override
-        public Socket connectSocket(
-                final int connectTimeout,
-                final Socket sock,
-                final HttpHost host,
-                final InetSocketAddress remoteAddress,
-                final InetSocketAddress localAddress,
-                final HttpContext context) throws IOException {
-            if(waitPolicy == WaitPolicy.BEFORE_CONNECT) {
-                latch();
-            }
-
-            final Socket socket = delegate.connectSocket(
-                    connectTimeout, sock, host, remoteAddress, localAddress, context);
-
-            if(waitPolicy == WaitPolicy.AFTER_CONNECT) {
-                latch();
-            }
-
-            return socket;
-        }
-
-        @Override
-        public Socket createSocket(final HttpContext context) throws IOException {
-            if(waitPolicy == WaitPolicy.BEFORE_CREATE) {
-                latch();
-            }
-
-            return delegate.createSocket(context);
-        }
-
-    }
-
-    private enum WaitPolicy { BEFORE_CREATE, BEFORE_CONNECT, AFTER_CONNECT, AFTER_OPEN }
-
 }

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestConnectionReuse.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestConnectionReuse.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestConnectionReuse.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/integration/TestConnectionReuse.java Tue Dec 27 19:48:07 2016
@@ -34,6 +34,8 @@ import org.apache.hc.client5.http.impl.s
 import org.apache.hc.client5.http.localserver.LocalServerTestBase;
 import org.apache.hc.client5.http.localserver.RandomHandler;
 import org.apache.hc.client5.http.methods.HttpGet;
+import org.apache.hc.core5.http.ClassicHttpResponse;
+import org.apache.hc.core5.http.EntityDetails;
 import org.apache.hc.core5.http.Header;
 import org.apache.hc.core5.http.HeaderElements;
 import org.apache.hc.core5.http.HttpException;
@@ -41,14 +43,10 @@ import org.apache.hc.core5.http.HttpHead
 import org.apache.hc.core5.http.HttpHost;
 import org.apache.hc.core5.http.HttpResponse;
 import org.apache.hc.core5.http.HttpResponseInterceptor;
-import org.apache.hc.core5.http.entity.EntityUtils;
+import org.apache.hc.core5.http.impl.HttpProcessors;
+import org.apache.hc.core5.http.io.entity.EntityUtils;
 import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.http.protocol.HttpProcessor;
-import org.apache.hc.core5.http.protocol.HttpProcessorBuilder;
-import org.apache.hc.core5.http.protocol.ResponseConnControl;
-import org.apache.hc.core5.http.protocol.ResponseContent;
-import org.apache.hc.core5.http.protocol.ResponseDate;
-import org.apache.hc.core5.http.protocol.ResponseServer;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -56,11 +54,7 @@ public class TestConnectionReuse extends
 
     @Test
     public void testReuseOfPersistentConnections() throws Exception {
-        final HttpProcessor httpproc = HttpProcessorBuilder.create()
-            .add(new ResponseDate())
-            .add(new ResponseServer(LocalServerTestBase.ORIGIN))
-            .add(new ResponseContent())
-            .add(new ResponseConnControl()).build();
+        final HttpProcessor httpproc = HttpProcessors.customServer(null).build();
 
         this.serverBootstrap.setHttpProcessor(httpproc)
                 .registerHandler("/random/*", new RandomHandler());
@@ -99,6 +93,7 @@ public class TestConnectionReuse extends
         @Override
         public void process(
                 final HttpResponse response,
+                final EntityDetails entityDetails,
                 final HttpContext context) throws HttpException, IOException {
             response.setHeader(HttpHeaders.CONNECTION, HeaderElements.CLOSE);
         }
@@ -107,11 +102,8 @@ public class TestConnectionReuse extends
 
     @Test
     public void testReuseOfClosedConnections() throws Exception {
-        final HttpProcessor httpproc = HttpProcessorBuilder.create()
-            .add(new ResponseDate())
-            .add(new ResponseServer(LocalServerTestBase.ORIGIN))
-            .add(new ResponseContent())
-            .add(new AlwaysCloseConn()).build();
+        final HttpProcessor httpproc = HttpProcessors.customServer(null)
+                .add(new AlwaysCloseConn()).build();
 
         this.serverBootstrap.setHttpProcessor(httpproc)
                 .registerHandler("/random/*", new RandomHandler());
@@ -147,11 +139,7 @@ public class TestConnectionReuse extends
 
     @Test
     public void testReuseOfAbortedConnections() throws Exception {
-        final HttpProcessor httpproc = HttpProcessorBuilder.create()
-            .add(new ResponseDate())
-            .add(new ResponseServer(LocalServerTestBase.ORIGIN))
-            .add(new ResponseContent())
-            .add(new ResponseConnControl()).build();
+        final HttpProcessor httpproc = HttpProcessors.customServer(null).build();
 
         this.serverBootstrap.setHttpProcessor(httpproc)
                 .registerHandler("/random/*", new RandomHandler());
@@ -187,12 +175,8 @@ public class TestConnectionReuse extends
 
     @Test
     public void testKeepAliveHeaderRespected() throws Exception {
-        final HttpProcessor httpproc = HttpProcessorBuilder.create()
-            .add(new ResponseDate())
-                .add(new ResponseServer(LocalServerTestBase.ORIGIN))
-            .add(new ResponseContent())
-            .add(new ResponseConnControl())
-            .add(new ResponseKeepAlive()).build();
+        final HttpProcessor httpproc = HttpProcessors.customServer(null)
+                .add(new ResponseKeepAlive()).build();
 
         this.serverBootstrap.setHttpProcessor(httpproc)
                 .registerHandler("/random/*", new RandomHandler());
@@ -202,7 +186,7 @@ public class TestConnectionReuse extends
 
         final HttpHost target = start();
 
-        HttpResponse response = this.httpclient.execute(target, new HttpGet("/random/2000"));
+        ClassicHttpResponse response = this.httpclient.execute(target, new HttpGet("/random/2000"));
         EntityUtils.consume(response.getEntity());
 
         Assert.assertEquals(1, this.connManager.getTotalStats().getAvailable());
@@ -257,7 +241,7 @@ public class TestConnectionReuse extends
             try {
                 for (int i = 0; i < this.repetitions; i++) {
                     final HttpGet httpget = new HttpGet(this.requestURI);
-                    final HttpResponse response = this.httpclient.execute(
+                    final ClassicHttpResponse response = this.httpclient.execute(
                             this.target,
                             httpget);
                     if (this.forceClose) {
@@ -281,8 +265,10 @@ public class TestConnectionReuse extends
     // if there is no Connection: close header.
     private static class ResponseKeepAlive implements HttpResponseInterceptor {
         @Override
-        public void process(final HttpResponse response, final HttpContext context)
-                throws HttpException, IOException {
+        public void process(
+                final HttpResponse response,
+                final EntityDetails entityDetails,
+                final HttpContext context) throws HttpException, IOException {
             final Header connection = response.getFirstHeader(HttpHeaders.CONNECTION);
             if(connection != null) {
                 if(!connection.getValue().equalsIgnoreCase("Close")) {



Mime
View raw message