hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1493350 - in /httpcomponents/httpclient/trunk/httpclient/src: examples/org/apache/http/examples/client/ main/java/org/apache/http/conn/ main/java/org/apache/http/impl/client/ main/java/org/apache/http/impl/conn/ test/java/org/apache/http/i...
Date Sat, 15 Jun 2013 12:50:57 GMT
Author: olegk
Date: Sat Jun 15 12:50:56 2013
New Revision: 1493350

URL: http://svn.apache.org/r1493350
Log:
HTTPCLIENT-1374: Added route parameter to HttpConnectionFactory

Removed:
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestManagedHttpClientConnectionFactory.java
Modified:
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientConfiguration.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/HttpConnectionFactory.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/ProxyClient.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionFactory.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestBasicHttpClientConnectionManager.java

Modified: httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientConfiguration.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientConfiguration.java?rev=1493350&r1=1493349&r2=1493350&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientConfiguration.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientConfiguration.java
Sat Jun 15 12:50:56 2013
@@ -130,7 +130,7 @@ public class ClientConfiguration {
         // initialization of outgoing HTTP connections. Beside standard connection
         // configuration parameters HTTP connection factory can define message
         // parser / writer routines to be employed by individual connections.
-        HttpConnectionFactory<ManagedHttpClientConnection> connFactory = new ManagedHttpClientConnectionFactory(
+        HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> connFactory =
new ManagedHttpClientConnectionFactory(
                 requestWriterFactory, responseParserFactory);
 
         // Client HTTP connection objects when fully initialized can be bound to

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/HttpConnectionFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/HttpConnectionFactory.java?rev=1493350&r1=1493349&r2=1493350&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/HttpConnectionFactory.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/HttpConnectionFactory.java
Sat Jun 15 12:50:56 2013
@@ -34,8 +34,8 @@ import org.apache.http.config.Connection
  *
  * @since 4.3
  */
-public interface HttpConnectionFactory<T extends HttpConnection> {
+public interface HttpConnectionFactory<T, C extends HttpConnection> {
 
-    T create(ConnectionConfig config);
+    C create(T route, ConnectionConfig config);
 
 }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/ProxyClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/ProxyClient.java?rev=1493350&r1=1493349&r2=1493350&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/ProxyClient.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/ProxyClient.java
Sat Jun 15 12:50:56 2013
@@ -79,7 +79,7 @@ import org.apache.http.util.EntityUtils;
 @SuppressWarnings("deprecation")
 public class ProxyClient {
 
-    private final HttpConnectionFactory<ManagedHttpClientConnection> connFactory;
+    private final HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> connFactory;
     private final ConnectionConfig connectionConfig;
     private final RequestConfig requestConfig;
     private final HttpProcessor httpProcessor;
@@ -94,7 +94,7 @@ public class ProxyClient {
      * @since 4.3
      */
     public ProxyClient(
-            final HttpConnectionFactory<ManagedHttpClientConnection> connFactory,
+            final HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> connFactory,
             final ConnectionConfig connectionConfig,
             final RequestConfig requestConfig) {
         super();
@@ -172,7 +172,8 @@ public class ProxyClient {
                 this.requestConfig.getLocalAddress(),
                 proxy, false, TunnelType.TUNNELLED, LayerType.PLAIN);
 
-        final ManagedHttpClientConnection conn = this.connFactory.create(this.connectionConfig);
+        final ManagedHttpClientConnection conn = this.connFactory.create(
+                route, this.connectionConfig);
         final HttpContext context = new BasicHttpContext();
         HttpResponse response = null;
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java?rev=1493350&r1=1493349&r2=1493350&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java
Sat Jun 15 12:50:56 2013
@@ -81,7 +81,7 @@ public class BasicHttpClientConnectionMa
     private final Log log = LogFactory.getLog(getClass());
 
     private final HttpClientConnectionOperator connectionOperator;
-    private final HttpConnectionFactory<ManagedHttpClientConnection> connFactory;
+    private final HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> connFactory;
 
     @GuardedBy("this")
     private ManagedHttpClientConnection conn;
@@ -119,7 +119,7 @@ public class BasicHttpClientConnectionMa
 
     public BasicHttpClientConnectionManager(
             final Lookup<ConnectionSocketFactory> socketFactoryRegistry,
-            final HttpConnectionFactory<ManagedHttpClientConnection> connFactory,
+            final HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> connFactory,
             final SchemePortResolver schemePortResolver,
             final DnsResolver dnsResolver) {
         super();
@@ -133,7 +133,7 @@ public class BasicHttpClientConnectionMa
 
     public BasicHttpClientConnectionManager(
             final Lookup<ConnectionSocketFactory> socketFactoryRegistry,
-            final HttpConnectionFactory<ManagedHttpClientConnection> connFactory) {
+            final HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> connFactory)
{
         this(socketFactoryRegistry, connFactory, null, null);
     }
 
@@ -252,7 +252,7 @@ public class BasicHttpClientConnectionMa
         this.state = state;
         checkExpiry();
         if (this.conn == null) {
-            this.conn = this.connFactory.create(this.connConfig);
+            this.conn = this.connFactory.create(route, this.connConfig);
         }
         this.leased = true;
         return this.conn;

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionFactory.java?rev=1493350&r1=1493349&r2=1493350&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionFactory.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/ManagedHttpClientConnectionFactory.java
Sat Jun 15 12:50:56 2013
@@ -41,6 +41,7 @@ import org.apache.http.annotation.Immuta
 import org.apache.http.config.ConnectionConfig;
 import org.apache.http.conn.HttpConnectionFactory;
 import org.apache.http.conn.ManagedHttpClientConnection;
+import org.apache.http.conn.routing.HttpRoute;
 import org.apache.http.impl.io.DefaultHttpRequestWriterFactory;
 import org.apache.http.io.HttpMessageParserFactory;
 import org.apache.http.io.HttpMessageWriterFactory;
@@ -49,7 +50,8 @@ import org.apache.http.io.HttpMessageWri
  * @since 4.3
  */
 @Immutable
-public class ManagedHttpClientConnectionFactory implements HttpConnectionFactory<ManagedHttpClientConnection>
{
+public class ManagedHttpClientConnectionFactory
+        implements HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> {
 
     private static final AtomicLong COUNTER = new AtomicLong();
 
@@ -81,7 +83,7 @@ public class ManagedHttpClientConnection
         this(null, null);
     }
 
-    public ManagedHttpClientConnection create(final ConnectionConfig config) {
+    public ManagedHttpClientConnection create(final HttpRoute route, final ConnectionConfig
config) {
         final ConnectionConfig cconfig = config != null ? config : ConnectionConfig.DEFAULT;
         CharsetDecoder chardecoder = null;
         CharsetEncoder charencoder = null;

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java?rev=1493350&r1=1493349&r2=1493350&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.java
Sat Jun 15 12:50:56 2013
@@ -120,25 +120,25 @@ public class PoolingHttpClientConnection
 
     public PoolingHttpClientConnectionManager(
             final Registry<ConnectionSocketFactory> socketFactoryRegistry,
-            final HttpConnectionFactory<ManagedHttpClientConnection> connFactory) {
+            final HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> connFactory)
{
         this(socketFactoryRegistry, connFactory, null);
     }
 
     public PoolingHttpClientConnectionManager(
-            final HttpConnectionFactory<ManagedHttpClientConnection> connFactory) {
+            final HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> connFactory)
{
         this(getDefaultRegistry(), connFactory, null);
     }
 
     public PoolingHttpClientConnectionManager(
             final Registry<ConnectionSocketFactory> socketFactoryRegistry,
-            final HttpConnectionFactory<ManagedHttpClientConnection> connFactory,
+            final HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> connFactory,
             final DnsResolver dnsResolver) {
         this(socketFactoryRegistry, connFactory, null, dnsResolver, -1, TimeUnit.MILLISECONDS);
     }
 
     public PoolingHttpClientConnectionManager(
             final Registry<ConnectionSocketFactory> socketFactoryRegistry,
-            final HttpConnectionFactory<ManagedHttpClientConnection> connFactory,
+            final HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> connFactory,
             final SchemePortResolver schemePortResolver,
             final DnsResolver dnsResolver,
             final long timeToLive, final TimeUnit tunit) {
@@ -477,11 +477,11 @@ public class PoolingHttpClientConnection
     static class InternalConnectionFactory implements ConnFactory<HttpRoute, ManagedHttpClientConnection>
{
 
         private final ConfigData configData;
-        private final HttpConnectionFactory<ManagedHttpClientConnection> connFactory;
+        private final HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection>
connFactory;
 
         InternalConnectionFactory(
                 final ConfigData configData,
-                final HttpConnectionFactory<ManagedHttpClientConnection> connFactory)
{
+                final HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection>
connFactory) {
             super();
             this.configData = configData != null ? configData : new ConfigData();
             this.connFactory = connFactory != null ? connFactory :
@@ -502,7 +502,7 @@ public class PoolingHttpClientConnection
             if (config == null) {
                 config = ConnectionConfig.DEFAULT;
             }
-            return this.connFactory.create(config);
+            return this.connFactory.create(route, config);
         }
 
     }

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestBasicHttpClientConnectionManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestBasicHttpClientConnectionManager.java?rev=1493350&r1=1493349&r2=1493350&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestBasicHttpClientConnectionManager.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/conn/TestBasicHttpClientConnectionManager.java
Sat Jun 15 12:50:56 2013
@@ -46,7 +46,7 @@ import org.mockito.Mockito;
 public class TestBasicHttpClientConnectionManager {
 
     private ManagedHttpClientConnection conn;
-    private HttpConnectionFactory<ManagedHttpClientConnection> connFactory;
+    private HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> connFactory;
     private Lookup<ConnectionSocketFactory> socketFactoryRegistry;
     private BasicHttpClientConnectionManager mgr;
 
@@ -64,7 +64,8 @@ public class TestBasicHttpClientConnecti
         final HttpHost target = new HttpHost("localhost");
         final HttpRoute route = new HttpRoute(target);
 
-        Mockito.when(connFactory.create(Mockito.<ConnectionConfig>any())).thenReturn(conn);
+        Mockito.when(connFactory.create(
+                Mockito.eq(route), Mockito.<ConnectionConfig>any())).thenReturn(conn);
 
         final ConnectionRequest connRequest1 = mgr.requestConnection(route, null);
         final HttpClientConnection conn1 = connRequest1.get(0, TimeUnit.MILLISECONDS);
@@ -81,7 +82,8 @@ public class TestBasicHttpClientConnecti
         Assert.assertNotNull(conn2);
         Assert.assertFalse(conn2.isOpen());
 
-        Mockito.verify(connFactory, Mockito.times(2)).create(Mockito.<ConnectionConfig>any());
+        Mockito.verify(connFactory, Mockito.times(2)).create(
+                Mockito.eq(route), Mockito.<ConnectionConfig>any());
     }
 
     @Test
@@ -89,13 +91,14 @@ public class TestBasicHttpClientConnecti
         final HttpHost target = new HttpHost("somehost");
         final HttpRoute route = new HttpRoute(target);
 
-        Mockito.when(connFactory.create(Mockito.<ConnectionConfig>any())).thenReturn(conn);
+        Mockito.when(connFactory.create(Mockito.eq(route), Mockito.<ConnectionConfig>any())).thenReturn(conn);
 
         final ConnectionRequest connRequest1 = mgr.requestConnection(route, null);
         final HttpClientConnection conn1 = connRequest1.get(0, TimeUnit.MILLISECONDS);
         Assert.assertNotNull(conn1);
 
-        Mockito.verify(connFactory, Mockito.times(1)).create(Mockito.<ConnectionConfig>any());
+        Mockito.verify(connFactory, Mockito.times(1)).create(
+                Mockito.eq(route), Mockito.<ConnectionConfig>any());
 
         Mockito.when(conn.isOpen()).thenReturn(Boolean.TRUE);
 
@@ -109,7 +112,8 @@ public class TestBasicHttpClientConnecti
         Assert.assertNotNull(conn2);
         Assert.assertTrue(conn2.isOpen());
 
-        Mockito.verify(connFactory, Mockito.times(1)).create(Mockito.<ConnectionConfig>any());
+        Mockito.verify(connFactory, Mockito.times(1)).create(
+                Mockito.eq(route), Mockito.<ConnectionConfig>any());
     }
 
     @Test
@@ -117,13 +121,15 @@ public class TestBasicHttpClientConnecti
         final HttpHost target = new HttpHost("somehost");
         final HttpRoute route = new HttpRoute(target);
 
-        Mockito.when(connFactory.create(Mockito.<ConnectionConfig>any())).thenReturn(conn);
+        Mockito.when(connFactory.create(
+                Mockito.eq(route), Mockito.<ConnectionConfig>any())).thenReturn(conn);
 
         final ConnectionRequest connRequest1 = mgr.requestConnection(route, "some state");
         final HttpClientConnection conn1 = connRequest1.get(0, TimeUnit.MILLISECONDS);
         Assert.assertNotNull(conn1);
 
-        Mockito.verify(connFactory, Mockito.times(1)).create(Mockito.<ConnectionConfig>any());
+        Mockito.verify(connFactory, Mockito.times(1)).create(
+                Mockito.eq(route), Mockito.<ConnectionConfig>any());
 
         Mockito.when(conn.isOpen()).thenReturn(Boolean.TRUE);
 
@@ -137,7 +143,8 @@ public class TestBasicHttpClientConnecti
         Assert.assertNotNull(conn2);
         Assert.assertTrue(conn2.isOpen());
 
-        Mockito.verify(connFactory, Mockito.times(1)).create(Mockito.<ConnectionConfig>any());
+        Mockito.verify(connFactory, Mockito.times(1)).create(
+                Mockito.eq(route), Mockito.<ConnectionConfig>any());
     }
 
     @Test
@@ -145,13 +152,15 @@ public class TestBasicHttpClientConnecti
         final HttpHost target1 = new HttpHost("somehost");
         final HttpRoute route1 = new HttpRoute(target1);
 
-        Mockito.when(connFactory.create(Mockito.<ConnectionConfig>any())).thenReturn(conn);
+        Mockito.when(connFactory.create(
+                Mockito.<HttpRoute>any(), Mockito.<ConnectionConfig>any())).thenReturn(conn);
 
         final ConnectionRequest connRequest1 = mgr.requestConnection(route1, null);
         final HttpClientConnection conn1 = connRequest1.get(0, TimeUnit.MILLISECONDS);
         Assert.assertNotNull(conn1);
 
-        Mockito.verify(connFactory, Mockito.times(1)).create(Mockito.<ConnectionConfig>any());
+        Mockito.verify(connFactory, Mockito.times(1)).create(
+                Mockito.eq(route1), Mockito.<ConnectionConfig>any());
 
         Mockito.when(conn.isOpen()).thenReturn(Boolean.TRUE, Boolean.FALSE);
 
@@ -168,7 +177,10 @@ public class TestBasicHttpClientConnecti
         Assert.assertFalse(conn2.isOpen());
 
         Mockito.verify(conn).close();
-        Mockito.verify(connFactory, Mockito.times(2)).create(Mockito.<ConnectionConfig>any());
+        Mockito.verify(connFactory, Mockito.times(1)).create(
+                Mockito.eq(route1), Mockito.<ConnectionConfig>any());
+        Mockito.verify(connFactory, Mockito.times(1)).create(
+                Mockito.eq(route2), Mockito.<ConnectionConfig>any());
     }
 
     @Test
@@ -176,13 +188,15 @@ public class TestBasicHttpClientConnecti
         final HttpHost target = new HttpHost("somehost");
         final HttpRoute route = new HttpRoute(target);
 
-        Mockito.when(connFactory.create(Mockito.<ConnectionConfig>any())).thenReturn(conn);
+        Mockito.when(connFactory.create(
+                Mockito.eq(route), Mockito.<ConnectionConfig>any())).thenReturn(conn);
 
         final ConnectionRequest connRequest1 = mgr.requestConnection(route, null);
         final HttpClientConnection conn1 = connRequest1.get(0, TimeUnit.MILLISECONDS);
         Assert.assertNotNull(conn1);
 
-        Mockito.verify(connFactory, Mockito.times(1)).create(Mockito.<ConnectionConfig>any());
+        Mockito.verify(connFactory, Mockito.times(1)).create(
+                Mockito.eq(route), Mockito.<ConnectionConfig>any());
 
         Mockito.when(conn.isOpen()).thenReturn(Boolean.TRUE, Boolean.FALSE);
 
@@ -199,7 +213,8 @@ public class TestBasicHttpClientConnecti
         Assert.assertFalse(conn2.isOpen());
 
         Mockito.verify(conn).close();
-        Mockito.verify(connFactory, Mockito.times(2)).create(Mockito.<ConnectionConfig>any());
+        Mockito.verify(connFactory, Mockito.times(2)).create(
+                Mockito.eq(route), Mockito.<ConnectionConfig>any());
     }
 
     @Test(expected=IllegalArgumentException.class)
@@ -223,13 +238,15 @@ public class TestBasicHttpClientConnecti
         final HttpHost target = new HttpHost("somehost");
         final HttpRoute route = new HttpRoute(target);
 
-        Mockito.when(connFactory.create(Mockito.<ConnectionConfig>any())).thenReturn(conn);
+        Mockito.when(connFactory.create(
+                Mockito.eq(route), Mockito.<ConnectionConfig>any())).thenReturn(conn);
 
         final ConnectionRequest connRequest1 = mgr.requestConnection(route, null);
         final HttpClientConnection conn1 = connRequest1.get(0, TimeUnit.MILLISECONDS);
         Assert.assertNotNull(conn1);
 
-        Mockito.verify(connFactory, Mockito.times(1)).create(Mockito.<ConnectionConfig>any());
+        Mockito.verify(connFactory, Mockito.times(1)).create(
+                Mockito.eq(route), Mockito.<ConnectionConfig>any());
 
         Mockito.when(conn.isOpen()).thenReturn(Boolean.TRUE);
 
@@ -252,13 +269,15 @@ public class TestBasicHttpClientConnecti
         final HttpHost target = new HttpHost("somehost");
         final HttpRoute route = new HttpRoute(target);
 
-        Mockito.when(connFactory.create(Mockito.<ConnectionConfig>any())).thenReturn(conn);
+        Mockito.when(connFactory.create(
+                Mockito.eq(route), Mockito.<ConnectionConfig>any())).thenReturn(conn);
 
         final ConnectionRequest connRequest1 = mgr.requestConnection(route, null);
         final HttpClientConnection conn1 = connRequest1.get(0, TimeUnit.MILLISECONDS);
         Assert.assertNotNull(conn1);
 
-        Mockito.verify(connFactory, Mockito.times(1)).create(Mockito.<ConnectionConfig>any());
+        Mockito.verify(connFactory, Mockito.times(1)).create(
+                Mockito.eq(route), Mockito.<ConnectionConfig>any());
 
         Mockito.when(conn.isOpen()).thenReturn(Boolean.TRUE, Boolean.FALSE);
 
@@ -279,13 +298,15 @@ public class TestBasicHttpClientConnecti
         final HttpHost target = new HttpHost("somehost");
         final HttpRoute route = new HttpRoute(target);
 
-        Mockito.when(connFactory.create(Mockito.<ConnectionConfig>any())).thenReturn(conn);
+        Mockito.when(connFactory.create(
+                Mockito.eq(route), Mockito.<ConnectionConfig>any())).thenReturn(conn);
 
         final ConnectionRequest connRequest1 = mgr.requestConnection(route, null);
         final HttpClientConnection conn1 = connRequest1.get(0, TimeUnit.MILLISECONDS);
         Assert.assertNotNull(conn1);
 
-        Mockito.verify(connFactory, Mockito.times(1)).create(Mockito.<ConnectionConfig>any());
+        Mockito.verify(connFactory, Mockito.times(1)).create(
+                Mockito.eq(route), Mockito.<ConnectionConfig>any());
 
         Mockito.when(conn.isOpen()).thenReturn(Boolean.TRUE, Boolean.FALSE);
 
@@ -306,7 +327,8 @@ public class TestBasicHttpClientConnecti
         final HttpHost target = new HttpHost("somehost");
         final HttpRoute route = new HttpRoute(target);
 
-        Mockito.when(connFactory.create(Mockito.<ConnectionConfig>any())).thenReturn(conn);
+        Mockito.when(connFactory.create(
+                Mockito.eq(route), Mockito.<ConnectionConfig>any())).thenReturn(conn);
 
         final ConnectionRequest connRequest1 = mgr.requestConnection(route, null);
         final HttpClientConnection conn1 = connRequest1.get(0, TimeUnit.MILLISECONDS);



Mime
View raw message