hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1776187 [19/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/protocol/TestDefaultRedirectStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/protocol/TestDefaultRedirectStrategy.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/protocol/TestDefaultRedirectStrategy.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/protocol/TestDefaultRedirectStrategy.java Tue Dec 27 19:48:07 2016
@@ -39,16 +39,13 @@ import org.apache.hc.client5.http.protoc
 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.HttpResponse;
 import org.apache.hc.core5.http.HttpStatus;
-import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.ProtocolException;
-import org.apache.hc.core5.http.entity.BasicHttpEntity;
+import org.apache.hc.core5.http.io.entity.BasicHttpEntity;
 import org.apache.hc.core5.http.message.BasicHttpResponse;
 import org.apache.hc.core5.http.protocol.BasicHttpContext;
 import org.apache.hc.core5.http.protocol.HttpContext;
-import org.apache.hc.core5.http.protocol.HttpCoreContext;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -59,8 +56,7 @@ public class TestDefaultRedirectStrategy
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
         final HttpClientContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("http://localhost/");
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
         Assert.assertFalse(redirectStrategy.isRedirected(httpget, response, context));
         response.setHeader(HttpHeaders.LOCATION, "http://localhost/blah");
         Assert.assertTrue(redirectStrategy.isRedirected(httpget, response, context));
@@ -71,8 +67,7 @@ public class TestDefaultRedirectStrategy
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
         final HttpClientContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("http://localhost/");
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
         Assert.assertFalse(redirectStrategy.isRedirected(httpget, response, context));
     }
 
@@ -81,8 +76,7 @@ public class TestDefaultRedirectStrategy
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
         final HttpClientContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("http://localhost/");
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_MOVED_PERMANENTLY, "Redirect");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_MOVED_PERMANENTLY, "Redirect");
         Assert.assertFalse(redirectStrategy.isRedirected(httpget, response, context));
         response.setHeader(HttpHeaders.LOCATION, "http://localhost/blah");
         Assert.assertTrue(redirectStrategy.isRedirected(httpget, response, context));
@@ -93,8 +87,7 @@ public class TestDefaultRedirectStrategy
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
         final HttpClientContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("http://localhost/");
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_TEMPORARY_REDIRECT, "Redirect");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_TEMPORARY_REDIRECT, "Redirect");
         Assert.assertFalse(redirectStrategy.isRedirected(httpget, response, context));
         response.setHeader(HttpHeaders.LOCATION, "http://localhost/blah");
         Assert.assertTrue(redirectStrategy.isRedirected(httpget, response, context));
@@ -105,8 +98,7 @@ public class TestDefaultRedirectStrategy
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
         final HttpClientContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("http://localhost/");
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_SEE_OTHER, "Redirect");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_SEE_OTHER, "Redirect");
         Assert.assertFalse(redirectStrategy.isRedirected(httpget, response, context));
         response.setHeader(HttpHeaders.LOCATION, "http://localhost/blah");
         Assert.assertTrue(redirectStrategy.isRedirected(httpget, response, context));
@@ -117,7 +109,7 @@ public class TestDefaultRedirectStrategy
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
         final HttpClientContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("http://localhost/");
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 333, "Redirect");
+        final HttpResponse response = new BasicHttpResponse(333, "Redirect");
         Assert.assertFalse(redirectStrategy.isRedirected(httpget, response, context));
         final HttpPost httppost = new HttpPost("http://localhost/");
         Assert.assertFalse(redirectStrategy.isRedirected(httppost, response, context));
@@ -128,8 +120,7 @@ public class TestDefaultRedirectStrategy
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
         final HttpClientContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("http://localhost/");
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_SEE_OTHER, "Redirect");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_SEE_OTHER, "Redirect");
         try {
             redirectStrategy.isRedirected(null, response, context);
             Assert.fail("IllegalArgumentException expected");
@@ -147,8 +138,7 @@ public class TestDefaultRedirectStrategy
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
         final HttpClientContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("http://localhost/");
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
         response.addHeader("Location", "http://localhost/stuff");
         final URI uri = redirectStrategy.getLocationURI(httpget, response, context);
         Assert.assertEquals(URI.create("http://localhost/stuff"), uri);
@@ -159,8 +149,7 @@ public class TestDefaultRedirectStrategy
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
         final HttpClientContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("http://localhost/");
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
         redirectStrategy.getLocationURI(httpget, response, context);
     }
 
@@ -169,8 +158,7 @@ public class TestDefaultRedirectStrategy
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
         final HttpClientContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("http://localhost/");
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
         response.addHeader("Location", "http://localhost/not valid");
         redirectStrategy.getLocationURI(httpget, response, context);
     }
@@ -179,22 +167,8 @@ public class TestDefaultRedirectStrategy
     public void testGetLocationUriRelative() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
         final HttpClientContext context = HttpClientContext.create();
-        context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, new HttpHost("localhost"));
         final HttpGet httpget = new HttpGet("http://localhost/");
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
-        response.addHeader("Location", "/stuff");
-        final URI uri = redirectStrategy.getLocationURI(httpget, response, context);
-        Assert.assertEquals(URI.create("http://localhost/stuff"), uri);
-    }
-
-    @Test(expected=IllegalStateException.class)
-    public void testGetLocationUriRelativeMissingTargetHost() throws Exception {
-        final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
-        final HttpClientContext context = HttpClientContext.create();
-        final HttpGet httpget = new HttpGet("http://localhost/");
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
         response.addHeader("Location", "/stuff");
         final URI uri = redirectStrategy.getLocationURI(httpget, response, context);
         Assert.assertEquals(URI.create("http://localhost/stuff"), uri);
@@ -204,10 +178,8 @@ public class TestDefaultRedirectStrategy
     public void testGetLocationUriRelativeWithFragment() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
         final HttpClientContext context = HttpClientContext.create();
-        context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, new HttpHost("localhost"));
         final HttpGet httpget = new HttpGet("http://localhost/");
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
         response.addHeader("Location", "/stuff#fragment");
         final URI uri = redirectStrategy.getLocationURI(httpget, response, context);
         Assert.assertEquals(URI.create("http://localhost/stuff#fragment"), uri);
@@ -217,10 +189,8 @@ public class TestDefaultRedirectStrategy
     public void testGetLocationUriAbsoluteWithFragment() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
         final HttpClientContext context = HttpClientContext.create();
-        context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, new HttpHost("localhost"));
         final HttpGet httpget = new HttpGet("http://localhost/");
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
         response.addHeader("Location", "http://localhost/stuff#fragment");
         final URI uri = redirectStrategy.getLocationURI(httpget, response, context);
         Assert.assertEquals(URI.create("http://localhost/stuff#fragment"), uri);
@@ -230,10 +200,8 @@ public class TestDefaultRedirectStrategy
     public void testGetLocationUriNormalized() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
         final HttpClientContext context = HttpClientContext.create();
-        context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, new HttpHost("localhost"));
         final HttpGet httpget = new HttpGet("http://localhost/");
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
         response.addHeader("Location", "http://localhost/././stuff/../morestuff");
         final URI uri = redirectStrategy.getLocationURI(httpget, response, context);
         Assert.assertEquals(URI.create("http://localhost/morestuff"), uri);
@@ -243,23 +211,19 @@ public class TestDefaultRedirectStrategy
     public void testGetLocationUriAllowCircularRedirects() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
         final HttpClientContext context = HttpClientContext.create();
-        context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, new HttpHost("localhost"));
         final RequestConfig config = RequestConfig.custom().setCircularRedirectsAllowed(true).build();
         context.setRequestConfig(config);
         final URI uri1 = URI.create("http://localhost/stuff1");
         final URI uri2 = URI.create("http://localhost/stuff2");
         final URI uri3 = URI.create("http://localhost/stuff3");
         final HttpGet httpget1 = new HttpGet("http://localhost/");
-        final HttpResponse response1 = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
+        final HttpResponse response1 = new BasicHttpResponse(HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
         response1.addHeader("Location", uri1.toASCIIString());
         final HttpGet httpget2 = new HttpGet(uri1.toASCIIString());
-        final HttpResponse response2 = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
+        final HttpResponse response2 = new BasicHttpResponse(HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
         response2.addHeader("Location", uri2.toASCIIString());
         final HttpGet httpget3 = new HttpGet(uri2.toASCIIString());
-        final HttpResponse response3 = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
+        final HttpResponse response3 = new BasicHttpResponse(HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
         response3.addHeader("Location", uri3.toASCIIString());
         Assert.assertEquals(uri1, redirectStrategy.getLocationURI(httpget1, response1, context));
         Assert.assertEquals(uri2, redirectStrategy.getLocationURI(httpget2, response2, context));
@@ -280,12 +244,10 @@ public class TestDefaultRedirectStrategy
     public void testGetLocationUriDisallowCircularRedirects() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
         final HttpClientContext context = HttpClientContext.create();
-        context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, new HttpHost("localhost"));
         final HttpGet httpget = new HttpGet("http://localhost/stuff");
         final RequestConfig config = RequestConfig.custom().setCircularRedirectsAllowed(false).build();
         context.setRequestConfig(config);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
         response.addHeader("Location", "http://localhost/stuff");
         final URI uri = URI.create("http://localhost/stuff");
         Assert.assertEquals(uri, redirectStrategy.getLocationURI(httpget, response, context));
@@ -297,8 +259,7 @@ public class TestDefaultRedirectStrategy
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
         final HttpClientContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("http://localhost/");
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
         response.addHeader("Location", "http://localhost/stuff");
         try {
             redirectStrategy.getLocationURI(null, response, context);
@@ -320,8 +281,7 @@ public class TestDefaultRedirectStrategy
     @Test
     public void testGetRedirectRequest() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_SEE_OTHER, "Redirect");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_SEE_OTHER, "Redirect");
         response.addHeader("Location", "http://localhost/stuff");
         final HttpContext context1 = new BasicHttpContext();
         final HttpUriRequest redirect1 = redirectStrategy.getRedirect(
@@ -340,8 +300,7 @@ public class TestDefaultRedirectStrategy
     @Test
     public void testGetRedirectRequestForTemporaryRedirect() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_TEMPORARY_REDIRECT, "Temporary Redirect");
+        final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_TEMPORARY_REDIRECT, "Temporary Redirect");
         response.addHeader("Location", "http://localhost/stuff");
         final HttpContext context1 = new BasicHttpContext();
         final HttpUriRequest redirect1 = redirectStrategy.getRedirect(

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestDefaultProxyRoutePlanner.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestDefaultProxyRoutePlanner.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestDefaultProxyRoutePlanner.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestDefaultProxyRoutePlanner.java Tue Dec 27 19:48:07 2016
@@ -33,7 +33,6 @@ import org.apache.hc.client5.http.config
 import org.apache.hc.client5.http.protocol.HttpClientContext;
 import org.apache.hc.core5.http.HttpHost;
 import org.apache.hc.core5.http.HttpRequest;
-import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.message.BasicHttpRequest;
 import org.apache.hc.core5.http.protocol.BasicHttpContext;
 import org.apache.hc.core5.http.protocol.HttpContext;
@@ -62,7 +61,7 @@ public class TestDefaultProxyRoutePlanne
     @Test
     public void testDefaultProxyDirect() throws Exception {
         final HttpHost target = new HttpHost("somehost", 80, "http");
-        final HttpRequest request = new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);
+        final HttpRequest request = new BasicHttpRequest("GET", "/");
 
         final HttpContext context = new BasicHttpContext();
         final HttpRoute route = routePlanner.determineRoute(target, request, context);
@@ -77,7 +76,7 @@ public class TestDefaultProxyRoutePlanne
     public void testViaProxy() throws Exception {
         final HttpHost target = new HttpHost("somehost", 80, "http");
         final HttpHost proxy = new HttpHost("custom.proxy.host", 8080);
-        final HttpRequest request = new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);
+        final HttpRequest request = new BasicHttpRequest("GET", "/");
 
         final HttpClientContext context = HttpClientContext.create();
         context.setRequestConfig(RequestConfig.custom().setProxy(proxy).build());

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestDefaultRoutePlanner.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestDefaultRoutePlanner.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestDefaultRoutePlanner.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestDefaultRoutePlanner.java Tue Dec 27 19:48:07 2016
@@ -33,7 +33,6 @@ import org.apache.hc.client5.http.config
 import org.apache.hc.client5.http.protocol.HttpClientContext;
 import org.apache.hc.core5.http.HttpHost;
 import org.apache.hc.core5.http.HttpRequest;
-import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.ProtocolException;
 import org.apache.hc.core5.http.message.BasicHttpRequest;
 import org.apache.hc.core5.http.protocol.BasicHttpContext;
@@ -61,7 +60,7 @@ public class TestDefaultRoutePlanner {
     @Test
     public void testDirect() throws Exception {
         final HttpHost target = new HttpHost("somehost", 80, "http");
-        final HttpRequest request = new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);
+        final HttpRequest request = new BasicHttpRequest("GET", "/");
 
         final HttpContext context = new BasicHttpContext();
         final HttpRoute route = routePlanner.determineRoute(target, request, context);
@@ -76,7 +75,7 @@ public class TestDefaultRoutePlanner {
     public void testDirectDefaultPort() throws Exception {
         final HttpHost target = new HttpHost("somehost", -1, "https");
         Mockito.when(schemePortResolver.resolve(target)).thenReturn(443);
-        final HttpRequest request = new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);
+        final HttpRequest request = new BasicHttpRequest("GET", "/");
 
         final HttpContext context = new BasicHttpContext();
         final HttpRoute route = routePlanner.determineRoute(target, request, context);
@@ -90,7 +89,7 @@ public class TestDefaultRoutePlanner {
     public void testViaProxy() throws Exception {
         final HttpHost target = new HttpHost("somehost", 80, "http");
         final HttpHost proxy = new HttpHost("proxy", 8080);
-        final HttpRequest request = new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);
+        final HttpRequest request = new BasicHttpRequest("GET", "/");
 
         final HttpClientContext context = HttpClientContext.create();
         context.setRequestConfig(RequestConfig.custom().setProxy(proxy).build());
@@ -105,7 +104,7 @@ public class TestDefaultRoutePlanner {
 
     @Test(expected= ProtocolException.class)
     public void testNullTarget() throws Exception {
-        final HttpRequest request = new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);
+        final HttpRequest request = new BasicHttpRequest("GET", "/");
 
         final HttpContext context = new BasicHttpContext();
         routePlanner.determineRoute(null, request, context);

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestSystemDefaultRoutePlanner.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestSystemDefaultRoutePlanner.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestSystemDefaultRoutePlanner.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/routing/TestSystemDefaultRoutePlanner.java Tue Dec 27 19:48:07 2016
@@ -39,7 +39,6 @@ import org.apache.hc.client5.http.HttpRo
 import org.apache.hc.client5.http.SchemePortResolver;
 import org.apache.hc.core5.http.HttpHost;
 import org.apache.hc.core5.http.HttpRequest;
-import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.message.BasicHttpRequest;
 import org.apache.hc.core5.http.protocol.BasicHttpContext;
 import org.apache.hc.core5.http.protocol.HttpContext;
@@ -69,7 +68,7 @@ public class TestSystemDefaultRoutePlann
     @Test
     public void testDirect() throws Exception {
         final HttpHost target = new HttpHost("somehost", 80, "http");
-        final HttpRequest request = new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);
+        final HttpRequest request = new BasicHttpRequest("GET", "/");
 
         final HttpContext context = new BasicHttpContext();
         final HttpRoute route = routePlanner.determineRoute(target, request, context);
@@ -84,7 +83,7 @@ public class TestSystemDefaultRoutePlann
     public void testDirectDefaultPort() throws Exception {
         final HttpHost target = new HttpHost("somehost", -1, "https");
         Mockito.when(schemePortResolver.resolve(target)).thenReturn(443);
-        final HttpRequest request = new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);
+        final HttpRequest request = new BasicHttpRequest("GET", "/");
 
         final HttpContext context = new BasicHttpContext();
         final HttpRoute route = routePlanner.determineRoute(target, request, context);
@@ -111,7 +110,7 @@ public class TestSystemDefaultRoutePlann
 
         final HttpHost target = new HttpHost("somehost", 80, "http");
         final HttpRequest request =
-            new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);
+            new BasicHttpRequest("GET", "/");
 
         final HttpContext context = new BasicHttpContext();
         final HttpRoute route = routePlanner.determineRoute(target, request, context);

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/MockConnPoolControl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/MockConnPoolControl.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/MockConnPoolControl.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/MockConnPoolControl.java Tue Dec 27 19:48:07 2016
@@ -28,6 +28,7 @@ package org.apache.hc.client5.http.impl.
 
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.hc.client5.http.HttpRoute;
 import org.apache.hc.core5.pool.ConnPoolControl;
@@ -92,6 +93,14 @@ public final class MockConnPoolControl i
         }
     }
 
+    @Override
+    public void closeIdle(final long idletime, final TimeUnit tunit) {
+    }
+
+    @Override
+    public void closeExpired() {
+    }
+
     public void setMaxForRoutes(final Map<HttpRoute, Integer> map) {
         if (map == null) {
             return;

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestCloseableHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestCloseableHttpClient.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestCloseableHttpClient.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestCloseableHttpClient.java Tue Dec 27 19:48:07 2016
@@ -29,14 +29,13 @@ package org.apache.hc.client5.http.impl.
 import java.io.IOException;
 import java.io.InputStream;
 
-import org.apache.hc.client5.http.methods.CloseableHttpResponse;
 import org.apache.hc.client5.http.methods.HttpGet;
-import org.apache.hc.client5.http.protocol.ClientProtocolException;
-import org.apache.hc.client5.http.sync.ResponseHandler;
+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.HttpHost;
-import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.io.ResponseHandler;
 import org.apache.hc.core5.http.protocol.HttpContext;
 import org.junit.Assert;
 import org.junit.Before;
@@ -54,7 +53,7 @@ public class TestCloseableHttpClient {
         @Override
         protected CloseableHttpResponse doExecute(
                 final HttpHost target,
-                final HttpRequest request,
+                final ClassicHttpRequest request,
                 final HttpContext context) throws IOException {
             return null;
         }
@@ -64,13 +63,15 @@ public class TestCloseableHttpClient {
     private NoopCloseableHttpClient client;
     private InputStream content;
     private HttpEntity entity;
+    private ClassicHttpResponse originResponse;
     private CloseableHttpResponse response;
 
     @Before
     public void setup() throws Exception {
         content = Mockito.mock(InputStream.class);
         entity = Mockito.mock(HttpEntity.class);
-        response = Mockito.mock(CloseableHttpResponse.class);
+        originResponse = Mockito.mock(ClassicHttpResponse.class);
+        response = CloseableHttpResponse.adapt(originResponse);
         Mockito.when(entity.getContent()).thenReturn(content);
         Mockito.when(entity.isStreaming()).thenReturn(Boolean.TRUE);
         Mockito.when(response.getEntity()).thenReturn(entity);
@@ -100,23 +101,6 @@ public class TestCloseableHttpClient {
     }
 
     @Test
-    public void testExecuteRequestInvalidHost() throws Exception {
-        final HttpGet httpget = new HttpGet("http://_/stuff");
-        client.execute(httpget);
-
-        Mockito.verify(client).doExecute(
-                Mockito.eq(new HttpHost("_", -1, "http")),
-                Mockito.same(httpget),
-                (HttpContext) Mockito.isNull());
-    }
-
-    @Test(expected=ClientProtocolException.class)
-    public void testExecuteRequestInvalidHost2() throws Exception {
-        final HttpGet httpget = new HttpGet("http://@/stuff");
-        client.execute(httpget);
-    }
-
-    @Test
     public void testExecuteRequest() throws Exception {
         final HttpGet httpget = new HttpGet("https://somehost:444/stuff");
 
@@ -166,7 +150,7 @@ public class TestCloseableHttpClient {
                     Mockito.eq(new HttpHost("somehost", 444, "https")),
                     Mockito.same(httpget),
                     (HttpContext) Mockito.isNull());
-            Mockito.verify(response).close();
+            Mockito.verify(originResponse).close();
             throw ex;
         }
     }

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestDefaultBackoffStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestDefaultBackoffStrategy.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestDefaultBackoffStrategy.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestDefaultBackoffStrategy.java Tue Dec 27 19:48:07 2016
@@ -36,7 +36,6 @@ import org.apache.hc.client5.http.Connec
 import org.apache.hc.client5.http.sync.ConnectionBackoffStrategy;
 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.message.BasicHttpResponse;
 import org.junit.Before;
 import org.junit.Test;
@@ -73,8 +72,7 @@ public class TestDefaultBackoffStrategy
 
     @Test
     public void backsOffForServiceUnavailable() {
-        final HttpResponse resp = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                HttpStatus.SC_SERVICE_UNAVAILABLE, "Service Unavailable");
+        final HttpResponse resp = new BasicHttpResponse(HttpStatus.SC_SERVICE_UNAVAILABLE, "Service Unavailable");
         assertTrue(impl.shouldBackoff(resp));
     }
 
@@ -84,8 +82,7 @@ public class TestDefaultBackoffStrategy
             if (i == HttpStatus.SC_SERVICE_UNAVAILABLE) {
                 continue;
             }
-            final HttpResponse resp = new BasicHttpResponse(HttpVersion.HTTP_1_1,
-                    i, "Foo");
+            final HttpResponse resp = new BasicHttpResponse(i, "Foo");
             assertFalse(impl.shouldBackoff(resp));
         }
     }

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestDefaultServiceUnavailableRetryStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestDefaultServiceUnavailableRetryStrategy.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestDefaultServiceUnavailableRetryStrategy.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestDefaultServiceUnavailableRetryStrategy.java Tue Dec 27 19:48:07 2016
@@ -31,7 +31,6 @@ import java.util.Date;
 import org.apache.hc.client5.http.utils.DateUtils;
 import org.apache.hc.core5.http.HttpHeaders;
 import org.apache.hc.core5.http.HttpResponse;
-import org.apache.hc.core5.http.HttpVersion;
 import org.apache.hc.core5.http.message.BasicHttpResponse;
 import org.junit.Assert;
 import org.junit.Before;
@@ -48,12 +47,12 @@ public class TestDefaultServiceUnavailab
 
     @Test
     public void testBasics() throws Exception {
-        final HttpResponse response1 = new BasicHttpResponse(HttpVersion.HTTP_1_1, 503, "Oppsie");
+        final HttpResponse response1 = new BasicHttpResponse(503, "Oppsie");
         Assert.assertTrue(this.impl.retryRequest(response1, 1, null));
         Assert.assertTrue(this.impl.retryRequest(response1, 2, null));
         Assert.assertTrue(this.impl.retryRequest(response1, 3, null));
         Assert.assertFalse(this.impl.retryRequest(response1, 4, null));
-        final HttpResponse response2 = new BasicHttpResponse(HttpVersion.HTTP_1_1, 500, "Big Time Oppsie");
+        final HttpResponse response2 = new BasicHttpResponse(500, "Big Time Oppsie");
         Assert.assertFalse(this.impl.retryRequest(response2, 1, null));
 
         Assert.assertEquals(1234, this.impl.getRetryInterval(response1, null));
@@ -61,7 +60,7 @@ public class TestDefaultServiceUnavailab
 
     @Test
     public void testRetryAfterHeaderAsLong() throws Exception {
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 503, "Oppsie");
+        final HttpResponse response = new BasicHttpResponse(503, "Oppsie");
         response.setHeader(HttpHeaders.RETRY_AFTER, "321");
 
         Assert.assertEquals(321000, this.impl.getRetryInterval(response, null));
@@ -70,7 +69,7 @@ public class TestDefaultServiceUnavailab
     @Test
     public void testRetryAfterHeaderAsDate() throws Exception {
         this.impl = new DefaultServiceUnavailableRetryStrategy(3, 1);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 503, "Oppsie");
+        final HttpResponse response = new BasicHttpResponse(503, "Oppsie");
 
         response.setHeader(HttpHeaders.RETRY_AFTER, DateUtils.formatDate(new Date(System.currentTimeMillis() + 100000L)));
 
@@ -79,7 +78,7 @@ public class TestDefaultServiceUnavailab
 
     @Test
     public void testRetryAfterHeaderAsPastDate() throws Exception {
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 503, "Oppsie");
+        final HttpResponse response = new BasicHttpResponse(503, "Oppsie");
 
         response.setHeader(HttpHeaders.RETRY_AFTER, DateUtils.formatDate(new Date(System.currentTimeMillis() - 100000L)));
 
@@ -90,7 +89,7 @@ public class TestDefaultServiceUnavailab
     public void testInvalidRetryAfterHeader() throws Exception {
         final DefaultServiceUnavailableRetryStrategy impl = new DefaultServiceUnavailableRetryStrategy(3, 1234);
 
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 503, "Oppsie");
+        final HttpResponse response = new BasicHttpResponse(503, "Oppsie");
         response.setHeader(HttpHeaders.RETRY_AFTER, "Stuff");
 
         Assert.assertEquals(1234, impl.getRetryInterval(response, null));

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestFutureRequestExecutionService.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestFutureRequestExecutionService.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestFutureRequestExecutionService.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestFutureRequestExecutionService.java Tue Dec 27 19:48:07 2016
@@ -41,14 +41,14 @@ import java.util.concurrent.atomic.Atomi
 
 import org.apache.hc.client5.http.methods.HttpGet;
 import org.apache.hc.client5.http.protocol.HttpClientContext;
-import org.apache.hc.client5.http.sync.ResponseHandler;
 import org.apache.hc.core5.concurrent.FutureCallback;
+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.HttpRequest;
-import org.apache.hc.core5.http.HttpResponse;
-import org.apache.hc.core5.http.bootstrap.io.HttpServer;
-import org.apache.hc.core5.http.bootstrap.io.ServerBootstrap;
+import org.apache.hc.core5.http.impl.io.bootstrap.HttpServer;
+import org.apache.hc.core5.http.impl.io.bootstrap.ServerBootstrap;
 import org.apache.hc.core5.http.io.HttpRequestHandler;
+import org.apache.hc.core5.http.io.ResponseHandler;
 import org.apache.hc.core5.http.protocol.HttpContext;
 import org.junit.After;
 import org.junit.Assert;
@@ -71,7 +71,8 @@ public class TestFutureRequestExecutionS
 
                 @Override
                 public void handle(
-                        final HttpRequest request, final HttpResponse response,
+                        final ClassicHttpRequest request,
+                        final ClassicHttpResponse response,
                         final HttpContext context) throws HttpException, IOException {
                     try {
                         while(blocked.get()) {
@@ -80,7 +81,7 @@ public class TestFutureRequestExecutionS
                     } catch (final InterruptedException e) {
                         throw new IllegalStateException(e);
                     }
-                    response.setStatusCode(200);
+                    response.setCode(200);
                 }
             }).create();
 
@@ -187,8 +188,8 @@ public class TestFutureRequestExecutionS
     private final class OkidokiHandler implements ResponseHandler<Boolean> {
         @Override
         public Boolean handleResponse(
-                final HttpResponse response) throws IOException {
-            return response.getStatusLine().getStatusCode() == 200;
+                final ClassicHttpResponse response) throws IOException {
+            return response.getCode() == 200;
         }
     }
 

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestIdleConnectionEvictor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestIdleConnectionEvictor.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestIdleConnectionEvictor.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestIdleConnectionEvictor.java Tue Dec 27 19:48:07 2016
@@ -48,8 +48,8 @@ public class TestIdleConnectionEvictor {
 
         Thread.sleep(1000);
 
-        Mockito.verify(cm, Mockito.atLeast(1)).closeExpiredConnections();
-        Mockito.verify(cm, Mockito.atLeast(1)).closeIdleConnections(3000, TimeUnit.MILLISECONDS);
+        Mockito.verify(cm, Mockito.atLeast(1)).closeExpired();
+        Mockito.verify(cm, Mockito.atLeast(1)).closeIdle(3000, TimeUnit.MILLISECONDS);
 
         Assert.assertTrue(connectionEvictor.isRunning());
 
@@ -67,8 +67,8 @@ public class TestIdleConnectionEvictor {
 
         Thread.sleep(1000);
 
-        Mockito.verify(cm, Mockito.atLeast(1)).closeExpiredConnections();
-        Mockito.verify(cm, Mockito.never()).closeIdleConnections(Mockito.anyLong(), Mockito.<TimeUnit>any());
+        Mockito.verify(cm, Mockito.atLeast(1)).closeExpired();
+        Mockito.verify(cm, Mockito.never()).closeIdle(Mockito.anyLong(), Mockito.<TimeUnit>any());
 
         Assert.assertTrue(connectionEvictor.isRunning());
 

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestInternalHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestInternalHttpClient.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestInternalHttpClient.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestInternalHttpClient.java Tue Dec 27 19:48:07 2016
@@ -38,12 +38,13 @@ import org.apache.hc.client5.http.cookie
 import org.apache.hc.client5.http.cookie.CookieStore;
 import org.apache.hc.client5.http.io.HttpClientConnectionManager;
 import org.apache.hc.client5.http.methods.HttpGet;
-import org.apache.hc.client5.http.methods.HttpRequestWrapper;
+import org.apache.hc.client5.http.methods.RoutedHttpRequest;
 import org.apache.hc.client5.http.protocol.ClientProtocolException;
 import org.apache.hc.client5.http.protocol.HttpClientContext;
 import org.apache.hc.client5.http.routing.HttpRoutePlanner;
 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.config.Lookup;
 import org.junit.Assert;
 import org.junit.Before;
@@ -95,7 +96,7 @@ public class TestInternalHttpClient {
         final HttpGet httpget = new HttpGet("http://somehost/stuff");
         final HttpRoute route = new HttpRoute(new HttpHost("somehost", 80));
 
-        final ArgumentCaptor<HttpRequestWrapper> argcap = ArgumentCaptor.forClass(HttpRequestWrapper.class);
+        final ArgumentCaptor<HttpRequest> argcap = ArgumentCaptor.forClass(HttpRequest.class);
         Mockito.when(routePlanner.determineRoute(
                 Mockito.eq(new HttpHost("somehost")),
                 argcap.capture(),
@@ -104,11 +105,10 @@ public class TestInternalHttpClient {
         client.execute(httpget);
 
         Assert.assertNotNull(argcap.getValue());
-        Assert.assertSame(httpget, argcap.getValue().getOriginal());
+        Assert.assertSame(httpget, argcap.getValue());
 
         Mockito.verify(execChain).execute(
-                Mockito.same(route),
-                Mockito.<HttpRequestWrapper>any(),
+                Mockito.<RoutedHttpRequest>any(),
                 Mockito.<HttpClientContext>any(),
                 Mockito.same(httpget));
     }
@@ -120,11 +120,10 @@ public class TestInternalHttpClient {
 
         Mockito.when(routePlanner.determineRoute(
                 Mockito.eq(new HttpHost("somehost")),
-                Mockito.<HttpRequestWrapper>any(),
+                Mockito.<RoutedHttpRequest>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(route);
         Mockito.when(execChain.execute(
-                Mockito.same(route),
-                Mockito.<HttpRequestWrapper>any(),
+                Mockito.<RoutedHttpRequest>any(),
                 Mockito.<HttpClientContext>any(),
                 Mockito.same(httpget))).thenThrow(new HttpException());
 
@@ -134,6 +133,13 @@ public class TestInternalHttpClient {
     @Test
     public void testExecuteDefaultContext() throws Exception {
         final HttpGet httpget = new HttpGet("http://somehost/stuff");
+        final HttpRoute route = new HttpRoute(new HttpHost("somehost", 80));
+
+        Mockito.when(routePlanner.determineRoute(
+                Mockito.eq(new HttpHost("somehost")),
+                Mockito.<RoutedHttpRequest>any(),
+                Mockito.<HttpClientContext>any())).thenReturn(route);
+
         final HttpClientContext context = HttpClientContext.create();
         client.execute(httpget, context);
 
@@ -147,6 +153,12 @@ public class TestInternalHttpClient {
     @Test
     public void testExecuteRequestConfig() throws Exception {
         final HttpGet httpget = new HttpGet("http://somehost/stuff");
+        final HttpRoute route = new HttpRoute(new HttpHost("somehost", 80));
+
+        Mockito.when(routePlanner.determineRoute(
+                Mockito.eq(new HttpHost("somehost")),
+                Mockito.<RoutedHttpRequest>any(),
+                Mockito.<HttpClientContext>any())).thenReturn(route);
 
         final RequestConfig config = RequestConfig.custom().build();
         httpget.setConfig(config);
@@ -160,6 +172,13 @@ public class TestInternalHttpClient {
     @Test
     public void testExecuteLocalContext() throws Exception {
         final HttpGet httpget = new HttpGet("http://somehost/stuff");
+        final HttpRoute route = new HttpRoute(new HttpHost("somehost", 80));
+
+        Mockito.when(routePlanner.determineRoute(
+                Mockito.eq(new HttpHost("somehost")),
+                Mockito.<RoutedHttpRequest>any(),
+                Mockito.<HttpClientContext>any())).thenReturn(route);
+
         final HttpClientContext context = HttpClientContext.create();
 
         final Lookup<CookieSpecProvider> localCookieSpecRegistry = Mockito.mock(Lookup.class);

Modified: httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestMainClientExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestMainClientExec.java?rev=1776187&r1=1776186&r2=1776187&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestMainClientExec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient5/src/test/java/org/apache/hc/client5/http/impl/sync/TestMainClientExec.java Tue Dec 27 19:48:07 2016
@@ -52,16 +52,17 @@ import org.apache.hc.client5.http.impl.a
 import org.apache.hc.client5.http.impl.io.ConnectionShutdownException;
 import org.apache.hc.client5.http.io.ConnectionRequest;
 import org.apache.hc.client5.http.io.HttpClientConnectionManager;
-import org.apache.hc.client5.http.methods.CloseableHttpResponse;
 import org.apache.hc.client5.http.methods.HttpExecutionAware;
 import org.apache.hc.client5.http.methods.HttpGet;
 import org.apache.hc.client5.http.methods.HttpPost;
-import org.apache.hc.client5.http.methods.HttpRequestWrapper;
+import org.apache.hc.client5.http.methods.RoutedHttpRequest;
 import org.apache.hc.client5.http.protocol.AuthenticationStrategy;
 import org.apache.hc.client5.http.protocol.HttpClientContext;
 import org.apache.hc.client5.http.protocol.NonRepeatableRequestException;
 import org.apache.hc.client5.http.protocol.UserTokenHandler;
 import org.apache.hc.core5.concurrent.Cancellable;
+import org.apache.hc.core5.http.ClassicHttpRequest;
+import org.apache.hc.core5.http.ClassicHttpResponse;
 import org.apache.hc.core5.http.ConnectionReuseStrategy;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpHeaders;
@@ -69,11 +70,11 @@ 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.HttpVersion;
-import org.apache.hc.core5.http.entity.EntityUtils;
-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.message.BasicHttpResponse;
+import org.apache.hc.core5.http.io.entity.EntityUtils;
+import org.apache.hc.core5.http.io.entity.StringEntity;
+import org.apache.hc.core5.http.message.BasicClassicHttpResponse;
 import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.http.protocol.HttpProcessor;
 import org.junit.Assert;
@@ -140,15 +141,14 @@ public class TestMainClientExec {
                 .setConnectionRequestTimeout(345)
                 .build();
         context.setRequestConfig(config);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
+        final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
         Mockito.when(requestExecutor.execute(
                 Mockito.same(request),
                 Mockito.<HttpClientConnection>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(response);
 
-        final CloseableHttpResponse finalResponse = mainClientExec.execute(
-                route, request, context, execAware);
+        final ClassicHttpResponse finalResponse = mainClientExec.execute(request, context, execAware);
         Mockito.verify(connManager).requestConnection(route, null);
         Mockito.verify(connRequest).get(345, TimeUnit.MILLISECONDS);
         Mockito.verify(execAware, Mockito.times(1)).setCancellable(connRequest);
@@ -163,7 +163,7 @@ public class TestMainClientExec {
         Assert.assertSame(managedConn, context.getConnection());
         Assert.assertNull(context.getUserToken());
         Assert.assertNotNull(finalResponse);
-        Assert.assertTrue(finalResponse instanceof HttpResponseProxy);
+        Assert.assertTrue(finalResponse instanceof CloseableHttpResponse);
     }
 
     @Test
@@ -174,8 +174,8 @@ public class TestMainClientExec {
                 .setConnectionRequestTimeout(345)
                 .build();
         context.setRequestConfig(config);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
+        final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
 
         Mockito.when(managedConn.isOpen()).thenReturn(Boolean.TRUE);
         Mockito.when(managedConn.isStale()).thenReturn(Boolean.FALSE);
@@ -191,8 +191,7 @@ public class TestMainClientExec {
                 Mockito.same(response),
                 Mockito.<HttpClientContext>any())).thenReturn(678L);
 
-        final CloseableHttpResponse finalResponse = mainClientExec.execute(
-                route, request, context, execAware);
+        final ClassicHttpResponse finalResponse = mainClientExec.execute(request, context, execAware);
         Mockito.verify(connManager).requestConnection(route, null);
         Mockito.verify(connRequest).get(345, TimeUnit.MILLISECONDS);
         Mockito.verify(requestExecutor, Mockito.times(1)).execute(request, managedConn, context);
@@ -200,7 +199,7 @@ public class TestMainClientExec {
         Mockito.verify(managedConn, Mockito.never()).close();
 
         Assert.assertNotNull(finalResponse);
-        Assert.assertTrue(finalResponse instanceof HttpResponseProxy);
+        Assert.assertTrue(finalResponse instanceof CloseableHttpResponse);
     }
 
     @Test
@@ -211,8 +210,8 @@ public class TestMainClientExec {
                 .setConnectionRequestTimeout(345)
                 .build();
         context.setRequestConfig(config);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
+        final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
 
         Mockito.when(managedConn.isOpen()).thenReturn(Boolean.TRUE);
         Mockito.when(managedConn.isStale()).thenReturn(Boolean.FALSE);
@@ -228,7 +227,7 @@ public class TestMainClientExec {
                 Mockito.same(route),
                 Mockito.<HttpClientContext>any())).thenReturn("this and that");
 
-        mainClientExec.execute(route, request, context, execAware);
+        mainClientExec.execute(request, context, execAware);
         Mockito.verify(connManager).requestConnection(route, null);
         Mockito.verify(connRequest).get(345, TimeUnit.MILLISECONDS);
         Mockito.verify(requestExecutor, Mockito.times(1)).execute(request, managedConn, context);
@@ -246,8 +245,8 @@ public class TestMainClientExec {
                 .setConnectionRequestTimeout(345)
                 .build();
         context.setRequestConfig(config);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
+        final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
         // The entity is streaming
         response.setEntity(EntityBuilder.create()
                 .setStream(new ByteArrayInputStream(new byte[]{}))
@@ -264,8 +263,7 @@ public class TestMainClientExec {
                 Mockito.same(response),
                 Mockito.<HttpClientContext>any())).thenReturn(Boolean.FALSE);
 
-        final CloseableHttpResponse finalResponse = mainClientExec.execute(
-                route, request, context, execAware);
+        final ClassicHttpResponse finalResponse = mainClientExec.execute(request, context, execAware);
         Mockito.verify(connManager).requestConnection(route, null);
         Mockito.verify(connRequest).get(345, TimeUnit.MILLISECONDS);
         Mockito.verify(requestExecutor, Mockito.times(1)).execute(request, managedConn, context);
@@ -277,7 +275,7 @@ public class TestMainClientExec {
         Mockito.verify(managedConn, Mockito.never()).close();
 
         Assert.assertNotNull(finalResponse);
-        Assert.assertTrue(finalResponse instanceof HttpResponseProxy);
+        Assert.assertTrue(finalResponse instanceof CloseableHttpResponse);
         finalResponse.close();
 
         Mockito.verify(connManager, Mockito.times(1)).releaseConnection(
@@ -290,16 +288,16 @@ public class TestMainClientExec {
         final HttpRoute route = new HttpRoute(target);
         final HttpClientContext context = new HttpClientContext();
         final RequestConfig config = RequestConfig.custom().setSocketTimeout(3000).build();
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
         context.setRequestConfig(config);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
         Mockito.when(managedConn.isOpen()).thenReturn(true);
         Mockito.when(requestExecutor.execute(
                 Mockito.same(request),
                 Mockito.<HttpClientConnection>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(response);
 
-        mainClientExec.execute(route, request, context, execAware);
+        mainClientExec.execute(request, context, execAware);
         Mockito.verify(managedConn).setSocketTimeout(3000);
     }
 
@@ -307,15 +305,15 @@ public class TestMainClientExec {
     public void testSocketTimeoutReset() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpClientContext context = new HttpClientContext();
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
+        final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
         Mockito.when(managedConn.isOpen()).thenReturn(Boolean.TRUE);
         Mockito.when(requestExecutor.execute(
                 Mockito.same(request),
                 Mockito.<HttpClientConnection>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(response);
 
-        mainClientExec.execute(route, request, context, execAware);
+        mainClientExec.execute(request, context, execAware);
         Mockito.verify(managedConn, Mockito.never()).setSocketTimeout(Mockito.anyInt());
     }
 
@@ -323,12 +321,12 @@ public class TestMainClientExec {
     public void testExecAbortedPriorToConnectionLease() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpClientContext context = new HttpClientContext();
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
 
         Mockito.when(managedConn.isOpen()).thenReturn(Boolean.FALSE);
         Mockito.when(execAware.isAborted()).thenReturn(Boolean.TRUE);
         try {
-            mainClientExec.execute(route, request, context, execAware);
+            mainClientExec.execute(request, context, execAware);
         } catch (final IOException ex) {
             Mockito.verify(connRequest, Mockito.times(1)).cancel();
             throw ex;
@@ -343,12 +341,12 @@ public class TestMainClientExec {
                 .setConnectionRequestTimeout(345)
                 .build();
         context.setRequestConfig(config);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
 
         Mockito.when(managedConn.isOpen()).thenReturn(Boolean.FALSE);
         Mockito.when(execAware.isAborted()).thenReturn(Boolean.FALSE, Boolean.TRUE);
         try {
-            mainClientExec.execute(route, request, context, execAware);
+            mainClientExec.execute(request, context, execAware);
         } catch (final IOException ex) {
             Mockito.verify(connRequest, Mockito.times(1)).get(345, TimeUnit.MILLISECONDS);
             Mockito.verify(execAware, Mockito.times(2)).setCancellable(Mockito.<Cancellable>any());
@@ -370,12 +368,12 @@ public class TestMainClientExec {
                 .setConnectionRequestTimeout(345)
                 .build();
         context.setRequestConfig(config);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
 
         Mockito.when(managedConn.isOpen()).thenReturn(Boolean.FALSE);
         Mockito.when(execAware.isAborted()).thenReturn(Boolean.FALSE, Boolean.FALSE, Boolean.TRUE);
         try {
-            mainClientExec.execute(route, request, context, execAware);
+            mainClientExec.execute(request, context, execAware);
         } catch (final IOException ex) {
             Mockito.verify(connRequest, Mockito.times(1)).get(345, TimeUnit.MILLISECONDS);
             Mockito.verify(connManager, Mockito.times(1)).connect(managedConn, route, 567, context);
@@ -391,25 +389,25 @@ public class TestMainClientExec {
     public void testExecConnectionRequestFailed() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpClientContext context = new HttpClientContext();
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
 
         Mockito.when(connRequest.get(Mockito.anyInt(), Mockito.<TimeUnit>any()))
                 .thenThrow(new ExecutionException("Opppsie", null));
-        mainClientExec.execute(route, request, context, execAware);
+        mainClientExec.execute(request, context, execAware);
     }
 
     @Test
     public void testExecRequestRetryOnAuthChallenge() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpClientContext context = new HttpClientContext();
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
-        final HttpResponse response1 = new BasicHttpResponse(HttpVersion.HTTP_1_1, 401, "Huh?");
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://foo/test"), route);
+        final ClassicHttpResponse response1 = new BasicClassicHttpResponse(401, "Huh?");
         response1.setHeader(HttpHeaders.WWW_AUTHENTICATE, "Basic realm=test");
         final InputStream instream1 = Mockito.spy(new ByteArrayInputStream(new byte[] {1, 2, 3}));
         response1.setEntity(EntityBuilder.create()
                 .setStream(instream1)
                 .build());
-        final HttpResponse response2 = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final ClassicHttpResponse response2 = new BasicClassicHttpResponse(200, "OK");
         final InputStream instream2 = Mockito.spy(new ByteArrayInputStream(new byte[] {2, 3, 4}));
         response2.setEntity(EntityBuilder.create()
                 .setStream(instream2)
@@ -434,27 +432,27 @@ public class TestMainClientExec {
                 Mockito.<Map<String, AuthChallenge>>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(Collections.<AuthScheme>singletonList(new BasicScheme()));
 
-        final CloseableHttpResponse finalResponse = mainClientExec.execute(
-                route, request, context, execAware);
+        final ClassicHttpResponse finalResponse = mainClientExec.execute(
+                request, context, execAware);
         Mockito.verify(requestExecutor, Mockito.times(2)).execute(request, managedConn, context);
         Mockito.verify(instream1).close();
         Mockito.verify(instream2, Mockito.never()).close();
 
         Assert.assertNotNull(finalResponse);
-        Assert.assertEquals(200, finalResponse.getStatusLine().getStatusCode());
+        Assert.assertEquals(200, finalResponse.getCode());
     }
 
     @Test
     public void testExecEntityEnclosingRequestRetryOnAuthChallenge() throws Exception {
         final HttpRoute route = new HttpRoute(target, proxy);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
-        final HttpResponse response1 = new BasicHttpResponse(HttpVersion.HTTP_1_1, 401, "Huh?");
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://foo/test"), route);
+        final ClassicHttpResponse response1 = new BasicClassicHttpResponse(401, "Huh?");
         response1.setHeader(HttpHeaders.WWW_AUTHENTICATE, "Basic realm=test");
         final InputStream instream1 = Mockito.spy(new ByteArrayInputStream(new byte[] {1, 2, 3}));
         response1.setEntity(EntityBuilder.create()
                 .setStream(instream1)
                 .build());
-        final HttpResponse response2 = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final ClassicHttpResponse response2 = new BasicClassicHttpResponse(200, "OK");
         final InputStream instream2 = Mockito.spy(new ByteArrayInputStream(new byte[] {2, 3, 4}));
         response2.setEntity(EntityBuilder.create()
                 .setStream(instream2)
@@ -487,14 +485,14 @@ public class TestMainClientExec {
                 Mockito.<Map<String, AuthChallenge>>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(Collections.<AuthScheme>singletonList(new BasicScheme()));
 
-        final CloseableHttpResponse finalResponse = mainClientExec.execute(
-                route, request, context, execAware);
+        final ClassicHttpResponse finalResponse = mainClientExec.execute(
+                request, context, execAware);
         Mockito.verify(requestExecutor, Mockito.times(2)).execute(request, managedConn, context);
         Mockito.verify(managedConn).close();
         Mockito.verify(instream2, Mockito.never()).close();
 
         Assert.assertNotNull(finalResponse);
-        Assert.assertEquals(200, finalResponse.getStatusLine().getStatusCode());
+        Assert.assertEquals(200, finalResponse.getCode());
         Assert.assertNull(proxyAuthExchange.getAuthScheme());
     }
 
@@ -502,14 +500,14 @@ public class TestMainClientExec {
     public void testExecEntityEnclosingRequest() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpClientContext context = new HttpClientContext();
-        final HttpPost post = new HttpPost("http://bar/test");
+        final HttpPost post = new HttpPost("http://foo/test");
         final InputStream instream0 = new ByteArrayInputStream(new byte[] {1, 2, 3});
         post.setEntity(EntityBuilder.create()
                 .setStream(instream0)
                 .build());
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(post, target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(post, route);
 
-        final HttpResponse response1 = new BasicHttpResponse(HttpVersion.HTTP_1_1, 401, "Huh?");
+        final ClassicHttpResponse response1 = new BasicClassicHttpResponse(401, "Huh?");
         response1.setHeader(HttpHeaders.WWW_AUTHENTICATE, "Basic realm=test");
         final InputStream instream1 = new ByteArrayInputStream(new byte[] {1, 2, 3});
         response1.setEntity(EntityBuilder.create()
@@ -530,7 +528,7 @@ public class TestMainClientExec {
             @Override
             public HttpResponse answer(final InvocationOnMock invocationOnMock) throws Throwable {
                 final Object[] args = invocationOnMock.getArguments();
-                final HttpRequest requestEE = (HttpRequest) args[0];
+                final ClassicHttpRequest requestEE = (ClassicHttpRequest) args[0];
                 requestEE.getEntity().writeTo(new ByteArrayOutputStream());
                 return response1;
             }
@@ -546,36 +544,36 @@ public class TestMainClientExec {
                 Mockito.<Map<String, AuthChallenge>>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(Collections.<AuthScheme>singletonList(new BasicScheme()));
 
-        mainClientExec.execute(route, request, context, execAware);
+        mainClientExec.execute(request, context, execAware);
     }
 
     @Test(expected=InterruptedIOException.class)
     public void testExecConnectionShutDown() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpClientContext context = new HttpClientContext();
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
 
         Mockito.when(requestExecutor.execute(
-                Mockito.<HttpRequest>any(),
+                Mockito.<ClassicHttpRequest>any(),
                 Mockito.<HttpClientConnection>any(),
                 Mockito.<HttpClientContext>any())).thenThrow(new ConnectionShutdownException());
 
-        mainClientExec.execute(route, request, context, execAware);
+        mainClientExec.execute(request, context, execAware);
     }
 
     @Test(expected=RuntimeException.class)
     public void testExecRuntimeException() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpClientContext context = new HttpClientContext();
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
 
         Mockito.when(requestExecutor.execute(
-                Mockito.<HttpRequest>any(),
+                Mockito.<ClassicHttpRequest>any(),
                 Mockito.<HttpClientConnection>any(),
                 Mockito.<HttpClientContext>any())).thenThrow(new RuntimeException("Ka-boom"));
 
         try {
-            mainClientExec.execute(route, request, context, execAware);
+            mainClientExec.execute(request, context, execAware);
         } catch (final Exception ex) {
             Mockito.verify(connManager).releaseConnection(managedConn, null, 0, TimeUnit.MILLISECONDS);
 
@@ -587,15 +585,15 @@ public class TestMainClientExec {
     public void testExecHttpException() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpClientContext context = new HttpClientContext();
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
 
         Mockito.when(requestExecutor.execute(
-                Mockito.<HttpRequest>any(),
+                Mockito.<ClassicHttpRequest>any(),
                 Mockito.<HttpClientConnection>any(),
                 Mockito.<HttpClientContext>any())).thenThrow(new HttpException("Ka-boom"));
 
         try {
-            mainClientExec.execute(route, request, context, execAware);
+            mainClientExec.execute(request, context, execAware);
         } catch (final Exception ex) {
             Mockito.verify(connManager).releaseConnection(managedConn, null, 0, TimeUnit.MILLISECONDS);
 
@@ -607,15 +605,15 @@ public class TestMainClientExec {
     public void testExecIOException() throws Exception {
         final HttpRoute route = new HttpRoute(target);
         final HttpClientContext context = new HttpClientContext();
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
 
         Mockito.when(requestExecutor.execute(
-                Mockito.<HttpRequest>any(),
+                Mockito.<ClassicHttpRequest>any(),
                 Mockito.<HttpClientConnection>any(),
                 Mockito.<HttpClientContext>any())).thenThrow(new IOException("Ka-boom"));
 
         try {
-            mainClientExec.execute(route, request, context, execAware);
+            mainClientExec.execute(request, context, execAware);
         } catch (final Exception ex) {
             Mockito.verify(connManager).releaseConnection(managedConn, null, 0, TimeUnit.MILLISECONDS);
 
@@ -631,7 +629,7 @@ public class TestMainClientExec {
                 .setConnectTimeout(567)
                 .build();
         context.setRequestConfig(config);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
 
         Mockito.when(managedConn.isOpen()).thenReturn(Boolean.TRUE);
 
@@ -649,7 +647,7 @@ public class TestMainClientExec {
                 .setConnectTimeout(567)
                 .build();
         context.setRequestConfig(config);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
 
         Mockito.when(managedConn.isOpen()).thenReturn(Boolean.TRUE);
 
@@ -667,12 +665,12 @@ public class TestMainClientExec {
                 .setConnectTimeout(321)
                 .build();
         context.setRequestConfig(config);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
+        final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
 
         Mockito.when(managedConn.isOpen()).thenReturn(Boolean.TRUE);
         Mockito.when(requestExecutor.execute(
-                Mockito.<HttpRequest>any(),
+                Mockito.<ClassicHttpRequest>any(),
                 Mockito.<HttpClientConnection>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(response);
 
@@ -680,28 +678,28 @@ public class TestMainClientExec {
 
         Mockito.verify(connManager).connect(managedConn, route, 321, context);
         Mockito.verify(connManager).routeComplete(managedConn, route, context);
-        final ArgumentCaptor<HttpRequest> reqCaptor = ArgumentCaptor.forClass(HttpRequest.class);
+        final ArgumentCaptor<ClassicHttpRequest> reqCaptor = ArgumentCaptor.forClass(ClassicHttpRequest.class);
         Mockito.verify(requestExecutor).execute(
                 reqCaptor.capture(),
                 Mockito.same(managedConn),
                 Mockito.same(context));
         final HttpRequest connect = reqCaptor.getValue();
         Assert.assertNotNull(connect);
-        Assert.assertEquals("CONNECT", connect.getRequestLine().getMethod());
-        Assert.assertEquals(HttpVersion.HTTP_1_1, connect.getRequestLine().getProtocolVersion());
-        Assert.assertEquals("foo:80", connect.getRequestLine().getUri());
+        Assert.assertEquals("CONNECT", connect.getMethod());
+        Assert.assertEquals(HttpVersion.HTTP_1_1, connect.getVersion());
+        Assert.assertEquals("foo:80", connect.getRequestUri());
     }
 
     @Test(expected = HttpException.class)
     public void testEstablishRouteViaProxyTunnelUnexpectedResponse() throws Exception {
         final HttpRoute route = new HttpRoute(target, null, proxy, true);
         final HttpClientContext context = new HttpClientContext();
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 101, "Lost");
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
+        final ClassicHttpResponse response = new BasicClassicHttpResponse(101, "Lost");
 
         Mockito.when(managedConn.isOpen()).thenReturn(Boolean.TRUE);
         Mockito.when(requestExecutor.execute(
-                Mockito.<HttpRequest>any(),
+                Mockito.<ClassicHttpRequest>any(),
                 Mockito.<HttpClientConnection>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(response);
 
@@ -712,20 +710,20 @@ public class TestMainClientExec {
     public void testEstablishRouteViaProxyTunnelFailure() throws Exception {
         final HttpRoute route = new HttpRoute(target, null, proxy, true);
         final HttpClientContext context = new HttpClientContext();
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
-        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 500, "Boom");
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
+        final ClassicHttpResponse response = new BasicClassicHttpResponse(500, "Boom");
         response.setEntity(new StringEntity("Ka-boom"));
 
         Mockito.when(managedConn.isOpen()).thenReturn(Boolean.TRUE);
         Mockito.when(requestExecutor.execute(
-                Mockito.<HttpRequest>any(),
+                Mockito.<ClassicHttpRequest>any(),
                 Mockito.<HttpClientConnection>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(response);
 
         try {
             mainClientExec.establishRoute(managedConn, route, request, context);
         } catch (final TunnelRefusedException ex) {
-            final HttpResponse r = ex.getResponse();
+            final ClassicHttpResponse r = ex.getResponse();
             Assert.assertEquals("Ka-boom", EntityUtils.toString(r.getEntity()));
 
             Mockito.verify(managedConn).close();
@@ -742,14 +740,14 @@ public class TestMainClientExec {
                 .setConnectTimeout(567)
                 .build();
         context.setRequestConfig(config);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
-        final HttpResponse response1 = new BasicHttpResponse(HttpVersion.HTTP_1_1, 407, "Huh?");
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
+        final ClassicHttpResponse response1 = new BasicClassicHttpResponse(407, "Huh?");
         response1.setHeader(HttpHeaders.PROXY_AUTHENTICATE, "Basic realm=test");
         final InputStream instream1 = Mockito.spy(new ByteArrayInputStream(new byte[] {1, 2, 3}));
         response1.setEntity(EntityBuilder.create()
                 .setStream(instream1)
                 .build());
-        final HttpResponse response2 = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final ClassicHttpResponse response2 = new BasicClassicHttpResponse(200, "OK");
 
         final BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
         credentialsProvider.setCredentials(new AuthScope(proxy), new UsernamePasswordCredentials("user", "pass".toCharArray()));
@@ -761,7 +759,7 @@ public class TestMainClientExec {
                 Mockito.<HttpResponse>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(Boolean.TRUE);
         Mockito.when(requestExecutor.execute(
-                Mockito.<HttpRequest>any(),
+                Mockito.<ClassicHttpRequest>any(),
                 Mockito.<HttpClientConnection>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(response1, response2);
 
@@ -785,14 +783,14 @@ public class TestMainClientExec {
                 .setConnectTimeout(567)
                 .build();
         context.setRequestConfig(config);
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
-        final HttpResponse response1 = new BasicHttpResponse(HttpVersion.HTTP_1_1, 407, "Huh?");
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
+        final ClassicHttpResponse response1 = new BasicClassicHttpResponse(407, "Huh?");
         response1.setHeader(HttpHeaders.PROXY_AUTHENTICATE, "Basic realm=test");
         final InputStream instream1 = Mockito.spy(new ByteArrayInputStream(new byte[] {1, 2, 3}));
         response1.setEntity(EntityBuilder.create()
                 .setStream(instream1)
                 .build());
-        final HttpResponse response2 = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
+        final ClassicHttpResponse response2 = new BasicClassicHttpResponse(200, "OK");
 
         final BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
         credentialsProvider.setCredentials(new AuthScope(proxy), new UsernamePasswordCredentials("user", "pass".toCharArray()));
@@ -804,7 +802,7 @@ public class TestMainClientExec {
                 Mockito.<HttpResponse>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(Boolean.FALSE);
         Mockito.when(requestExecutor.execute(
-                Mockito.<HttpRequest>any(),
+                Mockito.<ClassicHttpRequest>any(),
                 Mockito.<HttpClientConnection>any(),
                 Mockito.<HttpClientContext>any())).thenReturn(response1, response2);
 
@@ -828,11 +826,11 @@ public class TestMainClientExec {
         final HttpRoute route = new HttpRoute(target, null, new HttpHost[] {proxy1, proxy2},
                 true, RouteInfo.TunnelType.TUNNELLED, RouteInfo.LayerType.LAYERED);
         final HttpClientContext context = new HttpClientContext();
-        final HttpRequestWrapper request = HttpRequestWrapper.wrap(new HttpGet("http://bar/test"), target);
+        final RoutedHttpRequest request = RoutedHttpRequest.adapt(new HttpGet("http://bar/test"), route);
 
         Mockito.when(managedConn.isOpen()).thenReturn(Boolean.TRUE);
 
         mainClientExec.establishRoute(managedConn, route, request, context);
     }
 
-}
\ No newline at end of file
+}



Mime
View raw message