hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1414678 [3/4] - in /httpcomponents/httpclient/trunk: fluent-hc/src/main/java/org/apache/http/client/fluent/ httpclient/src/examples/org/apache/http/examples/client/ httpclient/src/main/java/org/apache/http/client/protocol/ httpclient/src/m...
Date Wed, 28 Nov 2012 13:39:48 GMT
Added: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/SystemDefaultRoutePlanner.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/SystemDefaultRoutePlanner.java?rev=1414678&view=auto
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/SystemDefaultRoutePlanner.java (added)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/SystemDefaultRoutePlanner.java Wed Nov 28 13:39:31 2012
@@ -0,0 +1,142 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.impl.conn;
+
+import java.net.InetSocketAddress;
+import java.net.Proxy;
+import java.net.ProxySelector;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.List;
+
+import org.apache.http.HttpException;
+import org.apache.http.HttpHost;
+import org.apache.http.HttpRequest;
+import org.apache.http.annotation.Immutable;
+import org.apache.http.conn.SchemePortResolver;
+import org.apache.http.conn.routing.HttpRoutePlanner;
+import org.apache.http.protocol.HttpContext;
+
+/**
+ * {@link HttpRoutePlanner} implementation based on {@link ProxySelector}.
+ * By default, it will pick up the proxy settings of the JVM, either
+ * from system properties or from the browser running the application.
+ * Additionally, it interprets some
+ * {@link org.apache.http.conn.params.ConnRoutePNames parameters},
+ * though not the {@link
+ * org.apache.http.conn.params.ConnRoutePNames#DEFAULT_PROXY DEFAULT_PROXY}.
+ * <p>
+ * The following parameters can be used to customize the behavior of this
+ * class:
+ * <ul>
+ *  <li>{@link org.apache.http.conn.params.ConnRoutePNames#LOCAL_ADDRESS}</li>
+ *  <li>{@link org.apache.http.conn.params.ConnRoutePNames#FORCED_ROUTE}</li>
+ * </ul>
+ *
+ * @since 4.3
+ */
+@Immutable
+public class SystemDefaultRoutePlanner extends DefaultRoutePlanner {
+
+    private final ProxySelector proxySelector;
+
+    public SystemDefaultRoutePlanner(
+            final SchemePortResolver schemePortResolver,
+            final ProxySelector proxySelector) {
+        super(schemePortResolver);
+        this.proxySelector = proxySelector != null ? proxySelector : ProxySelector.getDefault();
+    }
+
+    protected HttpHost determineProxy(
+            final HttpHost    target,
+            final HttpRequest request,
+            final HttpContext context) throws HttpException {
+        URI targetURI = null;
+        try {
+            targetURI = new URI(target.toURI());
+        } catch (URISyntaxException ex) {
+            throw new HttpException("Cannot convert host to URI: " + target, ex);
+        }
+        List<Proxy> proxies = this.proxySelector.select(targetURI);
+        Proxy p = chooseProxy(proxies, target, request, context);
+        HttpHost result = null;
+        if (p.type() == Proxy.Type.HTTP) {
+            // convert the socket address to an HttpHost
+            if (!(p.address() instanceof InetSocketAddress)) {
+                throw new HttpException("Unable to handle non-Inet proxy address: " + p.address());
+            }
+            InetSocketAddress isa = (InetSocketAddress) p.address();
+            // assume default scheme (http)
+            result = new HttpHost(getHost(isa), isa.getPort());
+        }
+
+        return result;
+    }
+
+    private String getHost(InetSocketAddress isa) {
+
+        //@@@ Will this work with literal IPv6 addresses, or do we
+        //@@@ need to wrap these in [] for the string representation?
+        //@@@ Having it in this method at least allows for easy workarounds.
+       return isa.isUnresolved() ?
+            isa.getHostName() : isa.getAddress().getHostAddress();
+
+    }
+
+    private Proxy chooseProxy(
+            final List<Proxy> proxies,
+            final HttpHost target,
+            final HttpRequest request,
+            final HttpContext context) {
+        Proxy result = null;
+        // check the list for one we can use
+        for (int i=0; (result == null) && (i < proxies.size()); i++) {
+            Proxy p = proxies.get(i);
+            switch (p.type()) {
+
+            case DIRECT:
+            case HTTP:
+                result = p;
+                break;
+
+            case SOCKS:
+                // SOCKS hosts are not handled on the route level.
+                // The socket may make use of the SOCKS host though.
+                break;
+            }
+        }
+        if (result == null) {
+            //@@@ log as warning or info that only a socks proxy is available?
+            // result can only be null if all proxies are socks proxies
+            // socks proxies are not handled on the route planning level
+            result = Proxy.NO_PROXY;
+        }
+        return result;
+    }
+
+}

Propchange: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/SystemDefaultRoutePlanner.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/SystemDefaultRoutePlanner.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/SystemDefaultRoutePlanner.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/BestMatchSpecFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/BestMatchSpecFactory.java?rev=1414678&r1=1414677&r2=1414678&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/BestMatchSpecFactory.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/BestMatchSpecFactory.java Wed Nov 28 13:39:31 2012
@@ -33,24 +33,33 @@ import org.apache.http.annotation.Immuta
 
 import org.apache.http.cookie.CookieSpec;
 import org.apache.http.cookie.CookieSpecFactory;
+import org.apache.http.cookie.CookieSpecProvider;
 import org.apache.http.cookie.params.CookieSpecPNames;
 import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.HttpContext;
 
 /**
- * {@link CookieSpecFactory} implementation that creates and initializes
+ * {@link CookieSpecProvider} implementation that creates and initializes
  * {@link BestMatchSpec} instances.
- * <p>
- * The following parameters can be used to customize the behavior of this
- * class:
- * <ul>
- *  <li>{@link org.apache.http.cookie.params.CookieSpecPNames#DATE_PATTERNS}</li>
- *  <li>{@link org.apache.http.cookie.params.CookieSpecPNames#SINGLE_COOKIE_HEADER}</li>
- * </ul>
  *
  * @since 4.0
  */
 @Immutable
-public class BestMatchSpecFactory implements CookieSpecFactory {
+@SuppressWarnings("deprecation")
+public class BestMatchSpecFactory implements CookieSpecFactory, CookieSpecProvider {
+
+    private final String[] datepatterns;
+    private final boolean oneHeader;
+
+    public BestMatchSpecFactory(final String[] datepatterns, final boolean oneHeader) {
+        super();
+        this.datepatterns = datepatterns;
+        this.oneHeader = oneHeader;
+    }
+
+    public BestMatchSpecFactory() {
+        this(null, false);
+    }
 
     public CookieSpec newInstance(final HttpParams params) {
         if (params != null) {
@@ -71,4 +80,8 @@ public class BestMatchSpecFactory implem
         }
     }
 
+    public CookieSpec create(final HttpContext context) {
+        return new BestMatchSpec(this.datepatterns, this.oneHeader);
+    }
+
 }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/BrowserCompatSpecFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/BrowserCompatSpecFactory.java?rev=1414678&r1=1414677&r2=1414678&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/BrowserCompatSpecFactory.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/BrowserCompatSpecFactory.java Wed Nov 28 13:39:31 2012
@@ -33,23 +33,31 @@ import org.apache.http.annotation.Immuta
 
 import org.apache.http.cookie.CookieSpec;
 import org.apache.http.cookie.CookieSpecFactory;
+import org.apache.http.cookie.CookieSpecProvider;
 import org.apache.http.cookie.params.CookieSpecPNames;
 import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.HttpContext;
 
 /**
- * {@link CookieSpecFactory} implementation that creates and initializes
+ * {@link CookieSpecProvider} implementation that creates and initializes
  * {@link BrowserCompatSpec} instances.
- * <p>
- * The following parameters can be used to customize the behavior of this
- * class:
- * <ul>
- *  <li>{@link org.apache.http.cookie.params.CookieSpecPNames#DATE_PATTERNS}</li>
- * </ul>
  *
  * @since 4.0
  */
 @Immutable
-public class BrowserCompatSpecFactory implements CookieSpecFactory {
+@SuppressWarnings("deprecation")
+public class BrowserCompatSpecFactory implements CookieSpecFactory, CookieSpecProvider {
+
+    private final String[] datepatterns;
+
+    public BrowserCompatSpecFactory(final String[] datepatterns) {
+        super();
+        this.datepatterns = datepatterns;
+    }
+
+    public BrowserCompatSpecFactory() {
+        this(null);
+    }
 
     public CookieSpec newInstance(final HttpParams params) {
         if (params != null) {
@@ -67,4 +75,8 @@ public class BrowserCompatSpecFactory im
         }
     }
 
+    public CookieSpec create(final HttpContext context) {
+        return new BrowserCompatSpec(this.datepatterns);
+    }
+
 }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpecFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpecFactory.java?rev=1414678&r1=1414677&r2=1414678&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpecFactory.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/IgnoreSpecFactory.java Wed Nov 28 13:39:31 2012
@@ -30,18 +30,29 @@ package org.apache.http.impl.cookie;
 import org.apache.http.annotation.Immutable;
 import org.apache.http.cookie.CookieSpec;
 import org.apache.http.cookie.CookieSpecFactory;
+import org.apache.http.cookie.CookieSpecProvider;
 import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.HttpContext;
 
 /**
- * {@link CookieSpecFactory} implementation that ignores all cookies.
+ * {@link CookieSpecProvider} implementation that ignores all cookies.
  *
  * @since 4.1
  */
 @Immutable
-public class IgnoreSpecFactory implements CookieSpecFactory {
+@SuppressWarnings("deprecation")
+public class IgnoreSpecFactory implements CookieSpecFactory, CookieSpecProvider {
+
+    public IgnoreSpecFactory() {
+        super();
+    }
 
     public CookieSpec newInstance(final HttpParams params) {
         return new IgnoreSpec();
     }
 
+    public CookieSpec create(final HttpContext context) {
+        return new IgnoreSpec();
+    }
+
 }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftSpecFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftSpecFactory.java?rev=1414678&r1=1414677&r2=1414678&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftSpecFactory.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/NetscapeDraftSpecFactory.java Wed Nov 28 13:39:31 2012
@@ -33,23 +33,31 @@ import org.apache.http.annotation.Immuta
 
 import org.apache.http.cookie.CookieSpec;
 import org.apache.http.cookie.CookieSpecFactory;
+import org.apache.http.cookie.CookieSpecProvider;
 import org.apache.http.cookie.params.CookieSpecPNames;
 import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.HttpContext;
 
 /**
- * {@link CookieSpecFactory} implementation that creates and initializes
+ * {@link CookieSpecProvider} implementation that creates and initializes
  * {@link NetscapeDraftSpec} instances.
- * <p>
- * The following parameters can be used to customize the behavior of this
- * class:
- * <ul>
- *  <li>{@link org.apache.http.cookie.params.CookieSpecPNames#DATE_PATTERNS}</li>
- * </ul>
  *
  * @since 4.0
  */
 @Immutable
-public class NetscapeDraftSpecFactory implements CookieSpecFactory {
+@SuppressWarnings("deprecation")
+public class NetscapeDraftSpecFactory implements CookieSpecFactory, CookieSpecProvider {
+
+    private final String[] datepatterns;
+
+    public NetscapeDraftSpecFactory(final String[] datepatterns) {
+        super();
+        this.datepatterns = datepatterns;
+    }
+
+    public NetscapeDraftSpecFactory() {
+        this(null);
+    }
 
     public CookieSpec newInstance(final HttpParams params) {
         if (params != null) {
@@ -67,4 +75,8 @@ public class NetscapeDraftSpecFactory im
         }
     }
 
+    public CookieSpec create(final HttpContext context) {
+        return new NetscapeDraftSpec(this.datepatterns);
+    }
+
 }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109SpecFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109SpecFactory.java?rev=1414678&r1=1414677&r2=1414678&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109SpecFactory.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2109SpecFactory.java Wed Nov 28 13:39:31 2012
@@ -33,24 +33,33 @@ import org.apache.http.annotation.Immuta
 
 import org.apache.http.cookie.CookieSpec;
 import org.apache.http.cookie.CookieSpecFactory;
+import org.apache.http.cookie.CookieSpecProvider;
 import org.apache.http.cookie.params.CookieSpecPNames;
 import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.HttpContext;
 
 /**
- * {@link CookieSpecFactory} implementation that creates and initializes
+ * {@link CookieSpecProvider} implementation that creates and initializes
  * {@link RFC2109Spec} instances.
- * <p>
- * The following parameters can be used to customize the behavior of this
- * class:
- * <ul>
- *  <li>{@link org.apache.http.cookie.params.CookieSpecPNames#DATE_PATTERNS}</li>
- *  <li>{@link org.apache.http.cookie.params.CookieSpecPNames#SINGLE_COOKIE_HEADER}</li>
- * </ul>
  *
  * @since 4.0
  */
 @Immutable
-public class RFC2109SpecFactory implements CookieSpecFactory {
+@SuppressWarnings("deprecation")
+public class RFC2109SpecFactory implements CookieSpecFactory, CookieSpecProvider {
+
+    private final String[] datepatterns;
+    private final boolean oneHeader;
+
+    public RFC2109SpecFactory(final String[] datepatterns, final boolean oneHeader) {
+        super();
+        this.datepatterns = datepatterns;
+        this.oneHeader = oneHeader;
+    }
+
+    public RFC2109SpecFactory() {
+        this(null, false);
+    }
 
     public CookieSpec newInstance(final HttpParams params) {
         if (params != null) {
@@ -71,4 +80,8 @@ public class RFC2109SpecFactory implemen
         }
     }
 
+    public CookieSpec create(final HttpContext context) {
+        return new RFC2109Spec(this.datepatterns, this.oneHeader);
+    }
+
 }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965SpecFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965SpecFactory.java?rev=1414678&r1=1414677&r2=1414678&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965SpecFactory.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/cookie/RFC2965SpecFactory.java Wed Nov 28 13:39:31 2012
@@ -33,24 +33,33 @@ import org.apache.http.annotation.Immuta
 
 import org.apache.http.cookie.CookieSpec;
 import org.apache.http.cookie.CookieSpecFactory;
+import org.apache.http.cookie.CookieSpecProvider;
 import org.apache.http.cookie.params.CookieSpecPNames;
 import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.HttpContext;
 
 /**
- * {@link CookieSpecFactory} implementation that creates and initializes
+ * {@link CookieSpecProvider} implementation that creates and initializes
  * {@link RFC2965Spec} instances.
- * <p>
- * The following parameters can be used to customize the behavior of this
- * class:
- * <ul>
- *  <li>{@link org.apache.http.cookie.params.CookieSpecPNames#DATE_PATTERNS}</li>
- *  <li>{@link org.apache.http.cookie.params.CookieSpecPNames#SINGLE_COOKIE_HEADER}</li>
- * </ul>
  *
  * @since 4.0
  */
 @Immutable
-public class RFC2965SpecFactory implements CookieSpecFactory {
+@SuppressWarnings("deprecation")
+public class RFC2965SpecFactory implements CookieSpecFactory, CookieSpecProvider {
+
+    private final String[] datepatterns;
+    private final boolean oneHeader;
+
+    public RFC2965SpecFactory(final String[] datepatterns, final boolean oneHeader) {
+        super();
+        this.datepatterns = datepatterns;
+        this.oneHeader = oneHeader;
+    }
+
+    public RFC2965SpecFactory() {
+        this(null, false);
+    }
 
     public CookieSpec newInstance(final HttpParams params) {
         if (params != null) {
@@ -71,4 +80,8 @@ public class RFC2965SpecFactory implemen
         }
     }
 
+    public CookieSpec create(final HttpContext context) {
+        return new RFC2965Spec(this.datepatterns, this.oneHeader);
+    }
+
 }

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRequestAddCookies.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRequestAddCookies.java?rev=1414678&r1=1414677&r2=1414678&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRequestAddCookies.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRequestAddCookies.java Wed Nov 28 13:39:31 2012
@@ -29,22 +29,20 @@ package org.apache.http.client.protocol;
 import java.util.Date;
 
 import org.apache.http.Header;
-import org.apache.http.HttpException;
 import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpRequestInterceptor;
 import org.apache.http.client.CookieStore;
 import org.apache.http.client.params.AllClientPNames;
 import org.apache.http.client.params.CookiePolicy;
+import org.apache.http.config.Lookup;
+import org.apache.http.config.RegistryBuilder;
 import org.apache.http.conn.routing.HttpRoute;
 import org.apache.http.conn.routing.RouteInfo.LayerType;
 import org.apache.http.conn.routing.RouteInfo.TunnelType;
-import org.apache.http.conn.scheme.PlainSocketFactory;
-import org.apache.http.conn.scheme.Scheme;
-import org.apache.http.conn.scheme.SchemeRegistry;
 import org.apache.http.cookie.CookieOrigin;
 import org.apache.http.cookie.CookieSpec;
-import org.apache.http.cookie.CookieSpecRegistry;
+import org.apache.http.cookie.CookieSpecProvider;
 import org.apache.http.cookie.SM;
 import org.apache.http.impl.client.BasicCookieStore;
 import org.apache.http.impl.cookie.BasicClientCookie;
@@ -64,12 +62,11 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
-@SuppressWarnings("boxing")
 public class TestRequestAddCookies {
 
     private HttpHost target;
     private CookieStore cookieStore;
-    private CookieSpecRegistry cookieSpecRegistry;
+    private Lookup<CookieSpecProvider> cookieSpecRegistry;
 
     @Before
     public void setUp() {
@@ -86,25 +83,14 @@ public class TestRequestAddCookies {
         cookie2.setPath("/");
         this.cookieStore.addCookie(cookie2);
 
-        this.cookieSpecRegistry = new CookieSpecRegistry();
-        this.cookieSpecRegistry.register(
-                CookiePolicy.BEST_MATCH,
-                new BestMatchSpecFactory());
-        this.cookieSpecRegistry.register(
-                CookiePolicy.BROWSER_COMPATIBILITY,
-                new BrowserCompatSpecFactory());
-        this.cookieSpecRegistry.register(
-                CookiePolicy.NETSCAPE,
-                new NetscapeDraftSpecFactory());
-        this.cookieSpecRegistry.register(
-                CookiePolicy.RFC_2109,
-                new RFC2109SpecFactory());
-        this.cookieSpecRegistry.register(
-                CookiePolicy.RFC_2965,
-                new RFC2965SpecFactory());
-        this.cookieSpecRegistry.register(
-                CookiePolicy.IGNORE_COOKIES,
-                new IgnoreSpecFactory());
+        this.cookieSpecRegistry = RegistryBuilder.<CookieSpecProvider>create()
+            .register(CookiePolicy.BEST_MATCH, new BestMatchSpecFactory())
+            .register(CookiePolicy.BROWSER_COMPATIBILITY, new BrowserCompatSpecFactory())
+            .register(CookiePolicy.NETSCAPE, new NetscapeDraftSpecFactory())
+            .register(CookiePolicy.RFC_2109, new RFC2109SpecFactory())
+            .register(CookiePolicy.RFC_2965, new RFC2965SpecFactory())
+            .register(CookiePolicy.IGNORE_COOKIES, new IgnoreSpecFactory())
+            .build();
     }
 
     @Test(expected=IllegalArgumentException.class)
@@ -293,7 +279,7 @@ public class TestRequestAddCookies {
         Assert.assertEquals("name1=value1; name2=value2", headers1[0].getValue());
     }
 
-    @Test(expected=HttpException.class)
+    @Test
     public void testAuthScopeInvalidRequestURI() throws Exception {
         HttpRequest request = new BasicHttpRequest("GET", "crap:");
 
@@ -314,18 +300,13 @@ public class TestRequestAddCookies {
         HttpRequest request = new BasicHttpRequest("GET", "/stuff");
 
         this.target = new HttpHost("localhost.local");
-        HttpRoute route = new HttpRoute(this.target, null, false);
-
-        Scheme http = new Scheme("http", 1234, PlainSocketFactory.getSocketFactory());
-        SchemeRegistry schemeRegistry = new SchemeRegistry();
-        schemeRegistry.register(http);
+        HttpRoute route = new HttpRoute(new HttpHost("localhost.local", 1234), null, false);
 
         HttpContext context = new BasicHttpContext();
         context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, this.target);
         context.setAttribute(ClientContext.ROUTE, route);
         context.setAttribute(ClientContext.COOKIE_STORE, this.cookieStore);
         context.setAttribute(ClientContext.COOKIESPEC_REGISTRY, this.cookieSpecRegistry);
-        context.setAttribute(ClientContext.SCHEME_REGISTRY, schemeRegistry);
 
         HttpRequestInterceptor interceptor = new RequestAddCookies();
         interceptor.process(request, context);
@@ -344,7 +325,8 @@ public class TestRequestAddCookies {
         HttpRequest request = new BasicHttpRequest("GET", "/stuff");
 
         this.target = new HttpHost("localhost.local");
-        HttpRoute route = new HttpRoute(this.target, null, new HttpHost("localhost", 8888), false);
+        HttpRoute route = new HttpRoute(
+                new HttpHost("localhost.local", 80), null, new HttpHost("localhost", 8888), false);
 
         HttpContext context = new BasicHttpContext();
         context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, this.target);
@@ -369,8 +351,9 @@ public class TestRequestAddCookies {
         HttpRequest request = new BasicHttpRequest("GET", "/stuff");
 
         this.target = new HttpHost("localhost", -1, "https");
-        HttpRoute route = new HttpRoute(this.target, null, new HttpHost("localhost", 8888), true,
-                TunnelType.TUNNELLED, LayerType.LAYERED);
+        HttpRoute route = new HttpRoute(
+                new HttpHost("localhost", 443, "https"), null,
+                new HttpHost("localhost", 8888), true, TunnelType.TUNNELLED, LayerType.LAYERED);
 
         HttpContext context = new BasicHttpContext();
         context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, this.target);

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRequestAuthCache.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRequestAuthCache.java?rev=1414678&r1=1414677&r2=1414678&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRequestAuthCache.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRequestAuthCache.java Wed Nov 28 13:39:31 2012
@@ -37,6 +37,7 @@ import org.apache.http.auth.AuthState;
 import org.apache.http.auth.Credentials;
 import org.apache.http.auth.UsernamePasswordCredentials;
 import org.apache.http.client.AuthCache;
+import org.apache.http.conn.routing.HttpRoute;
 import org.apache.http.impl.auth.BasicScheme;
 import org.apache.http.impl.client.BasicAuthCache;
 import org.apache.http.impl.client.BasicCredentialsProvider;
@@ -102,7 +103,7 @@ public class TestRequestAuthCache {
         HttpContext context = new BasicHttpContext();
         context.setAttribute(ClientContext.CREDS_PROVIDER, this.credProvider);
         context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, this.target);
-        context.setAttribute(ExecutionContext.HTTP_PROXY_HOST, this.proxy);
+        context.setAttribute(ClientContext.ROUTE, new HttpRoute(this.target, null, this.proxy, false));
         context.setAttribute(ClientContext.TARGET_AUTH_STATE, this.targetState);
         context.setAttribute(ClientContext.PROXY_AUTH_STATE, this.proxyState);
 
@@ -127,7 +128,7 @@ public class TestRequestAuthCache {
         HttpContext context = new BasicHttpContext();
         context.setAttribute(ClientContext.CREDS_PROVIDER, null);
         context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, this.target);
-        context.setAttribute(ExecutionContext.HTTP_PROXY_HOST, this.proxy);
+        context.setAttribute(ClientContext.ROUTE, new HttpRoute(this.target, null, this.proxy, false));
         context.setAttribute(ClientContext.TARGET_AUTH_STATE, this.targetState);
         context.setAttribute(ClientContext.PROXY_AUTH_STATE, this.proxyState);
 
@@ -152,7 +153,7 @@ public class TestRequestAuthCache {
         HttpContext context = new BasicHttpContext();
         context.setAttribute(ClientContext.CREDS_PROVIDER, this.credProvider);
         context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, this.target);
-        context.setAttribute(ExecutionContext.HTTP_PROXY_HOST, this.proxy);
+        context.setAttribute(ClientContext.ROUTE, new HttpRoute(this.target, null, this.proxy, false));
         context.setAttribute(ClientContext.TARGET_AUTH_STATE, this.targetState);
         context.setAttribute(ClientContext.PROXY_AUTH_STATE, this.proxyState);
         context.setAttribute(ClientContext.AUTH_CACHE, null);
@@ -172,7 +173,7 @@ public class TestRequestAuthCache {
         HttpContext context = new BasicHttpContext();
         context.setAttribute(ClientContext.CREDS_PROVIDER, this.credProvider);
         context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, this.target);
-        context.setAttribute(ExecutionContext.HTTP_PROXY_HOST, this.proxy);
+        context.setAttribute(ClientContext.ROUTE, new HttpRoute(this.target, null, this.proxy, false));
         context.setAttribute(ClientContext.TARGET_AUTH_STATE, this.targetState);
         context.setAttribute(ClientContext.PROXY_AUTH_STATE, this.proxyState);
 
@@ -196,7 +197,7 @@ public class TestRequestAuthCache {
         HttpContext context = new BasicHttpContext();
         context.setAttribute(ClientContext.CREDS_PROVIDER, this.credProvider);
         context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, this.target);
-        context.setAttribute(ExecutionContext.HTTP_PROXY_HOST, this.proxy);
+        context.setAttribute(ClientContext.ROUTE, new HttpRoute(this.target, null, this.proxy, false));
         context.setAttribute(ClientContext.TARGET_AUTH_STATE, this.targetState);
         context.setAttribute(ClientContext.PROXY_AUTH_STATE, this.proxyState);
 
@@ -221,7 +222,7 @@ public class TestRequestAuthCache {
         HttpContext context = new BasicHttpContext();
         context.setAttribute(ClientContext.CREDS_PROVIDER, this.credProvider);
         context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, this.target);
-        context.setAttribute(ExecutionContext.HTTP_PROXY_HOST, this.proxy);
+        context.setAttribute(ClientContext.ROUTE, new HttpRoute(this.target, null, this.proxy, false));
         context.setAttribute(ClientContext.TARGET_AUTH_STATE, this.targetState);
         context.setAttribute(ClientContext.PROXY_AUTH_STATE, this.proxyState);
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/TestScheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/TestScheme.java?rev=1414678&r1=1414677&r2=1414678&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/TestScheme.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/TestScheme.java Wed Nov 28 13:39:31 2012
@@ -40,6 +40,7 @@ import org.junit.Test;
 /**
  * Unit tests for {@link Scheme} and {@link SchemeRegistry}.
  */
+@Deprecated
 public class TestScheme {
 
     @Test

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/scheme/TestScheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/scheme/TestScheme.java?rev=1414678&r1=1414677&r2=1414678&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/scheme/TestScheme.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/scheme/TestScheme.java Wed Nov 28 13:39:31 2012
@@ -33,6 +33,7 @@ import org.junit.Test;
 /**
  * Unit tests for {@link Scheme}.
  */
+@Deprecated
 public class TestScheme {
 
     @Test

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java?rev=1414678&r1=1414677&r2=1414678&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java Wed Nov 28 13:39:31 2012
@@ -48,8 +48,8 @@ import javax.net.ssl.TrustManagerFactory
 import org.apache.http.HttpHost;
 import org.apache.http.localserver.LocalServerTestBase;
 import org.apache.http.localserver.LocalTestServer;
-import org.apache.http.params.BasicHttpParams;
-import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.BasicHttpContext;
+import org.apache.http.protocol.HttpContext;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -143,13 +143,13 @@ public class TestSSLSocketFactory extend
 
     @Test
     public void testBasicSSL() throws Exception {
+        HttpHost host = new HttpHost("localhost", 443, "https");
+        HttpContext context = new BasicHttpContext();
         TestX509HostnameVerifier hostVerifier = new TestX509HostnameVerifier();
-
-        HttpParams params = new BasicHttpParams();
         SSLSocketFactory socketFactory = new SSLSocketFactory(this.clientSSLContext, hostVerifier);
-        SSLSocket socket = (SSLSocket) socketFactory.createSocket(params);
-        InetSocketAddress address = this.localServer.getServiceAddress();
-        socket = (SSLSocket) socketFactory.connectSocket(socket, address, null, params);
+        SSLSocket socket = (SSLSocket) socketFactory.createSocket(context);
+        InetSocketAddress remoteAddress = this.localServer.getServiceAddress();
+        socket = (SSLSocket) socketFactory.connectSocket(0, socket, host, remoteAddress, null, context);
         SSLSession sslsession = socket.getSession();
 
         Assert.assertNotNull(sslsession);
@@ -158,6 +158,8 @@ public class TestSSLSocketFactory extend
 
     @Test(expected=SSLPeerUnverifiedException.class)
     public void testSSLTrustVerification() throws Exception {
+        HttpHost host = new HttpHost("localhost", 443, "https");
+        HttpContext context = new BasicHttpContext();
         // Use default SSL context
         SSLContext defaultsslcontext = SSLContext.getInstance("TLS");
         defaultsslcontext.init(null, null, null);
@@ -165,14 +167,15 @@ public class TestSSLSocketFactory extend
         SSLSocketFactory socketFactory = new SSLSocketFactory(defaultsslcontext,
                 SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
 
-        HttpParams params = new BasicHttpParams();
-        SSLSocket socket = (SSLSocket) socketFactory.createSocket(params);
-        InetSocketAddress address = this.localServer.getServiceAddress();
-        socketFactory.connectSocket(socket, address, null, params);
+        SSLSocket socket = (SSLSocket) socketFactory.createSocket(context);
+        InetSocketAddress remoteAddress = this.localServer.getServiceAddress();
+        socketFactory.connectSocket(0, socket, host, remoteAddress, null, context);
     }
 
     @Test
     public void testSSLTrustVerificationOverride() throws Exception {
+        HttpHost host = new HttpHost("localhost", 443, "https");
+        HttpContext context = new BasicHttpContext();
         // Use default SSL context
         SSLContext defaultsslcontext = SSLContext.getInstance("TLS");
         defaultsslcontext.init(null, null, null);
@@ -186,10 +189,9 @@ public class TestSSLSocketFactory extend
 
         }, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
 
-        HttpParams params = new BasicHttpParams();
-        SSLSocket socket = (SSLSocket) socketFactory.createSocket(params);
-        InetSocketAddress address = this.localServer.getServiceAddress();
-        socketFactory.connectSocket(socket, address, null, params);
+        SSLSocket socket = (SSLSocket) socketFactory.createSocket(context);
+        InetSocketAddress remoteAddress = this.localServer.getServiceAddress();
+        socketFactory.connectSocket(0, socket, host, remoteAddress, null, context);
     }
 
 }

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/cookie/TestCookiePolicy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/cookie/TestCookiePolicy.java?rev=1414678&r1=1414677&r2=1414678&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/cookie/TestCookiePolicy.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/cookie/TestCookiePolicy.java Wed Nov 28 13:39:31 2012
@@ -42,6 +42,7 @@ import org.junit.Test;
 /**
  * Test cases for {@link CookieSpecRegistry}.
  */
+@Deprecated
 public class TestCookiePolicy {
 
     private static final String BROWSER_COMPATIBILITY    = "BROWSER_COMPATIBILITY";

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestAuthenticationStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestAuthenticationStrategy.java?rev=1414678&r1=1414677&r2=1414678&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestAuthenticationStrategy.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestAuthenticationStrategy.java Wed Nov 28 13:39:31 2012
@@ -38,7 +38,7 @@ import org.apache.http.HttpVersion;
 import org.apache.http.auth.AUTH;
 import org.apache.http.auth.AuthOption;
 import org.apache.http.auth.AuthScheme;
-import org.apache.http.auth.AuthSchemeRegistry;
+import org.apache.http.auth.AuthSchemeProvider;
 import org.apache.http.auth.AuthScope;
 import org.apache.http.auth.UsernamePasswordCredentials;
 import org.apache.http.auth.params.AuthPNames;
@@ -46,6 +46,8 @@ import org.apache.http.client.AuthCache;
 import org.apache.http.client.CredentialsProvider;
 import org.apache.http.client.params.AuthPolicy;
 import org.apache.http.client.protocol.ClientContext;
+import org.apache.http.config.Registry;
+import org.apache.http.config.RegistryBuilder;
 import org.apache.http.impl.auth.BasicScheme;
 import org.apache.http.impl.auth.BasicSchemeFactory;
 import org.apache.http.impl.auth.DigestScheme;
@@ -175,9 +177,9 @@ public class TestAuthenticationStrategy 
         challenges.put("basic", new BasicHeader(AUTH.WWW_AUTH, "Basic realm=\"test\""));
         challenges.put("digest", new BasicHeader(AUTH.WWW_AUTH, "Digest realm=\"realm1\", nonce=\"1234\""));
 
-        AuthSchemeRegistry authSchemeRegistry = new AuthSchemeRegistry();
-        authSchemeRegistry.register("basic", new BasicSchemeFactory());
-        authSchemeRegistry.register("digest", new DigestSchemeFactory());
+        Registry<AuthSchemeProvider> authSchemeRegistry = RegistryBuilder.<AuthSchemeProvider>create()
+            .register("basic", new BasicSchemeFactory())
+            .register("digest", new DigestSchemeFactory()).build();
         context.setAttribute(ClientContext.AUTHSCHEME_REGISTRY, authSchemeRegistry);
 
         Queue<AuthOption> options = authStrategy.select(challenges, authhost, response, context);
@@ -196,9 +198,9 @@ public class TestAuthenticationStrategy 
         challenges.put("basic", new BasicHeader(AUTH.WWW_AUTH, "Basic realm=\"realm1\""));
         challenges.put("digest", new BasicHeader(AUTH.WWW_AUTH, "Digest realm=\"realm2\", nonce=\"1234\""));
 
-        AuthSchemeRegistry authSchemeRegistry = new AuthSchemeRegistry();
-        authSchemeRegistry.register("basic", new BasicSchemeFactory());
-        authSchemeRegistry.register("digest", new DigestSchemeFactory());
+        Registry<AuthSchemeProvider> authSchemeRegistry = RegistryBuilder.<AuthSchemeProvider>create()
+            .register("basic", new BasicSchemeFactory())
+            .register("digest", new DigestSchemeFactory()).build();
         context.setAttribute(ClientContext.AUTHSCHEME_REGISTRY, authSchemeRegistry);
 
         CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
@@ -220,9 +222,9 @@ public class TestAuthenticationStrategy 
         challenges.put("basic", new BasicHeader(AUTH.WWW_AUTH, "Basic realm=\"realm1\""));
         challenges.put("digest", new BasicHeader(AUTH.WWW_AUTH, "Digest realm=\"realm2\", nonce=\"1234\""));
 
-        AuthSchemeRegistry authSchemeRegistry = new AuthSchemeRegistry();
-        authSchemeRegistry.register("basic", new BasicSchemeFactory());
-        authSchemeRegistry.register("digest", new DigestSchemeFactory());
+        Registry<AuthSchemeProvider> authSchemeRegistry = RegistryBuilder.<AuthSchemeProvider>create()
+            .register("basic", new BasicSchemeFactory())
+            .register("digest", new DigestSchemeFactory()).build();
         context.setAttribute(ClientContext.AUTHSCHEME_REGISTRY, authSchemeRegistry);
 
         CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
@@ -249,9 +251,9 @@ public class TestAuthenticationStrategy 
         challenges.put("digest", new BasicHeader(AUTH.WWW_AUTH, "Digest realm=\"realm2\", nonce=\"1234\""));
         challenges.put("whatever", new BasicHeader(AUTH.WWW_AUTH, "Whatever realm=\"realm3\""));
 
-        AuthSchemeRegistry authSchemeRegistry = new AuthSchemeRegistry();
-        authSchemeRegistry.register("basic", new BasicSchemeFactory());
-        authSchemeRegistry.register("digest", new DigestSchemeFactory());
+        Registry<AuthSchemeProvider> authSchemeRegistry = RegistryBuilder.<AuthSchemeProvider>create()
+            .register("basic", new BasicSchemeFactory())
+            .register("digest", new DigestSchemeFactory()).build();
         context.setAttribute(ClientContext.AUTHSCHEME_REGISTRY, authSchemeRegistry);
 
         CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
@@ -281,9 +283,9 @@ public class TestAuthenticationStrategy 
         challenges.put("basic", new BasicHeader(AUTH.WWW_AUTH, "Basic realm=\"realm1\""));
         challenges.put("digest", new BasicHeader(AUTH.WWW_AUTH, "Digest realm=\"realm2\", nonce=\"1234\""));
 
-        AuthSchemeRegistry authSchemeRegistry = new AuthSchemeRegistry();
-        authSchemeRegistry.register("basic", new BasicSchemeFactory());
-        authSchemeRegistry.register("digest", new DigestSchemeFactory());
+        Registry<AuthSchemeProvider> authSchemeRegistry = RegistryBuilder.<AuthSchemeProvider>create()
+            .register("basic", new BasicSchemeFactory())
+            .register("digest", new DigestSchemeFactory()).build();
         context.setAttribute(ClientContext.AUTHSCHEME_REGISTRY, authSchemeRegistry);
 
         CredentialsProvider credentialsProvider = new BasicCredentialsProvider();

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestBasicAuthCache.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestBasicAuthCache.java?rev=1414678&r1=1414677&r2=1414678&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestBasicAuthCache.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestBasicAuthCache.java Wed Nov 28 13:39:31 2012
@@ -29,9 +29,7 @@ package org.apache.http.impl.client;
 
 import org.apache.http.HttpHost;
 import org.apache.http.auth.AuthScheme;
-import org.apache.http.conn.scheme.Scheme;
-import org.apache.http.conn.scheme.SchemeRegistry;
-import org.apache.http.conn.scheme.SchemeSocketFactory;
+import org.apache.http.conn.SchemePortResolver;
 import org.junit.Assert;
 import org.junit.Test;
 import org.mockito.Mockito;
@@ -64,11 +62,9 @@ public class TestBasicAuthCache {
 
     @Test
     public void testGetKeyWithSchemeRegistry() throws Exception {
-        SchemeSocketFactory socketFactory = Mockito.mock(SchemeSocketFactory.class);
-        Scheme scheme = new Scheme("https", 443, socketFactory);
-        SchemeRegistry registory = new SchemeRegistry();
-        registory.register(scheme);
-        BasicAuthCache cache = new BasicAuthCache(registory);
+        SchemePortResolver schemePortResolver = Mockito.mock(SchemePortResolver.class);
+        BasicAuthCache cache = new BasicAuthCache(schemePortResolver);
+        Mockito.when(schemePortResolver.resolve(new HttpHost("localhost", -1, "https"))).thenReturn(443);
         HttpHost target = new HttpHost("localhost", 443, "https");
         Assert.assertSame(target, cache.getKey(target));
         Assert.assertEquals(target, cache.getKey(new HttpHost("localhost", -1, "https")));

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestHttpAuthenticator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestHttpAuthenticator.java?rev=1414678&r1=1414677&r2=1414678&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestHttpAuthenticator.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestHttpAuthenticator.java Wed Nov 28 13:39:31 2012
@@ -38,7 +38,7 @@ import org.apache.http.HttpVersion;
 import org.apache.http.auth.AUTH;
 import org.apache.http.auth.AuthOption;
 import org.apache.http.auth.AuthProtocolState;
-import org.apache.http.auth.AuthSchemeRegistry;
+import org.apache.http.auth.AuthSchemeProvider;
 import org.apache.http.auth.AuthScope;
 import org.apache.http.auth.AuthState;
 import org.apache.http.auth.AuthenticationException;
@@ -48,6 +48,8 @@ import org.apache.http.auth.MalformedCha
 import org.apache.http.client.AuthCache;
 import org.apache.http.client.AuthenticationStrategy;
 import org.apache.http.client.protocol.ClientContext;
+import org.apache.http.config.Lookup;
+import org.apache.http.config.RegistryBuilder;
 import org.apache.http.impl.auth.BasicScheme;
 import org.apache.http.impl.auth.BasicSchemeFactory;
 import org.apache.http.impl.auth.DigestScheme;
@@ -71,10 +73,9 @@ public class TestHttpAuthenticator {
     private ContextAwareAuthScheme authScheme;
     private HttpContext context;
     private HttpHost host;
-    private HttpHost proxy;
     private Credentials credentials;
     private BasicCredentialsProvider credentialsProvider;
-    private AuthSchemeRegistry authSchemeRegistry;
+    private Lookup<AuthSchemeProvider> authSchemeRegistry;
     private AuthCache authCache;
     private HttpAuthenticator httpAuthenticator;
 
@@ -87,17 +88,15 @@ public class TestHttpAuthenticator {
         Mockito.when(this.authScheme.isComplete()).thenReturn(Boolean.TRUE);
         this.context = new BasicHttpContext();
         this.host = new HttpHost("localhost", 80);
-        this.proxy = new HttpHost("localhost", 8888);
         this.context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, this.host);
-        this.context.setAttribute(ExecutionContext.HTTP_PROXY_HOST, this.proxy);
         this.credentials = Mockito.mock(Credentials.class);
         this.credentialsProvider = new BasicCredentialsProvider();
         this.credentialsProvider.setCredentials(AuthScope.ANY, this.credentials);
         this.context.setAttribute(ClientContext.CREDS_PROVIDER, this.credentialsProvider);
-        this.authSchemeRegistry = new AuthSchemeRegistry();
-        this.authSchemeRegistry.register("basic", new BasicSchemeFactory());
-        this.authSchemeRegistry.register("digest", new DigestSchemeFactory());
-        this.authSchemeRegistry.register("ntlm", new NTLMSchemeFactory());
+        this.authSchemeRegistry = RegistryBuilder.<AuthSchemeProvider>create()
+            .register("basic", new BasicSchemeFactory())
+            .register("digest", new DigestSchemeFactory())
+            .register("ntlm", new NTLMSchemeFactory()).build();
         this.context.setAttribute(ClientContext.AUTHSCHEME_REGISTRY, this.authSchemeRegistry);
         this.authCache = Mockito.mock(AuthCache.class);
         this.context.setAttribute(ClientContext.AUTH_CACHE, this.authCache);

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestAbortHandling.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestAbortHandling.java?rev=1414678&r1=1414677&r2=1414678&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestAbortHandling.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestAbortHandling.java Wed Nov 28 13:39:31 2012
@@ -47,16 +47,11 @@ import org.apache.http.conn.ConnectionPo
 import org.apache.http.conn.ConnectionRequest;
 import org.apache.http.conn.HttpClientConnectionManager;
 import org.apache.http.conn.routing.HttpRoute;
-import org.apache.http.conn.scheme.Scheme;
-import org.apache.http.conn.scheme.SchemeRegistry;
 import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.HttpClients;
 import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
 import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
-import org.apache.http.impl.conn.SchemeRegistryFactory;
 import org.apache.http.message.BasicHeader;
-import org.apache.http.mockup.SocketFactoryMockup;
-import org.apache.http.params.HttpParams;
 import org.apache.http.protocol.BasicHttpContext;
 import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
@@ -302,14 +297,10 @@ public class TestAbortHandling extends I
                 Mockito.any(HttpClientConnection.class),
                 Mockito.any(HttpHost.class),
                 Mockito.any(InetAddress.class),
-                Mockito.any(HttpContext.class),
-                Mockito.any(HttpParams.class));
-
-        SchemeRegistry schemeRegistry = SchemeRegistryFactory.createDefault();
+                Mockito.any(HttpContext.class));
 
         Mockito.when(connmgr.requestConnection(
                 Mockito.any(HttpRoute.class), Mockito.any())).thenReturn(connrequest);
-        Mockito.when(connmgr.getSchemeRegistry()).thenReturn(schemeRegistry);
 
         final HttpClient client = HttpClients.custom().setConnectionManager(connmgr).build();
         final HttpContext context = new BasicHttpContext();
@@ -452,31 +443,28 @@ public class TestAbortHandling extends I
             };
         }
 
-        public HttpParams getParams() {
-            throw new UnsupportedOperationException("just a mockup");
-        }
-
-        public SchemeRegistry getSchemeRegistry() {
-            SchemeRegistry registry = new SchemeRegistry();
-            registry.register(new Scheme("http", 80, new SocketFactoryMockup(null)));
-            return registry;
-        }
-
         public void shutdown() {
         }
 
-        public void releaseConnection(HttpClientConnection conn, Object newState,
+        public void releaseConnection(
+                final HttpClientConnection conn,
+                final Object newState,
                 long validDuration, TimeUnit timeUnit) {
             throw new UnsupportedOperationException("just a mockup");
         }
 
-        public void connect(HttpClientConnection conn, HttpHost host, InetAddress localAddress,
-                HttpContext context, HttpParams params) throws IOException {
+        public void connect(
+                final HttpClientConnection conn,
+                final HttpHost host,
+                final InetAddress localAddress,
+                final HttpContext context) throws IOException {
             throw new UnsupportedOperationException("just a mockup");
         }
 
-        public void upgrade(HttpClientConnection conn, HttpHost host, HttpContext context,
-                HttpParams params) throws IOException {
+        public void upgrade(
+                final HttpClientConnection conn,
+                final HttpHost host,
+                final HttpContext context) throws IOException {
             throw new UnsupportedOperationException("just a mockup");
         }
     }

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestClientReauthentication.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestClientReauthentication.java?rev=1414678&r1=1414677&r2=1414678&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestClientReauthentication.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestClientReauthentication.java Wed Nov 28 13:39:31 2012
@@ -153,7 +153,7 @@ public class TestClientReauthentication 
         BasicSchemeFactory myBasicAuthSchemeFactory = new BasicSchemeFactory() {
 
             @Override
-            public AuthScheme newInstance(HttpParams params) {
+            public AuthScheme create(HttpContext context) {
                 return new BasicScheme() {
 
                     @Override

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionManagement.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionManagement.java?rev=1414678&r1=1414677&r2=1414678&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionManagement.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionManagement.java Wed Nov 28 13:39:31 2012
@@ -31,7 +31,6 @@ import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.Socket;
 import java.net.SocketException;
-import java.net.UnknownHostException;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
@@ -43,21 +42,18 @@ import org.apache.http.HttpRequestInterc
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpStatus;
 import org.apache.http.HttpVersion;
+import org.apache.http.config.Registry;
+import org.apache.http.config.RegistryBuilder;
 import org.apache.http.conn.ConnectTimeoutException;
 import org.apache.http.conn.ConnectionPoolTimeoutException;
 import org.apache.http.conn.ConnectionRequest;
 import org.apache.http.conn.HttpClientConnectionManager;
 import org.apache.http.conn.routing.HttpRoute;
-import org.apache.http.conn.scheme.PlainSocketFactory;
-import org.apache.http.conn.scheme.Scheme;
-import org.apache.http.conn.scheme.SchemeRegistry;
-import org.apache.http.conn.scheme.SchemeSocketFactory;
+import org.apache.http.conn.socket.ConnectionSocketFactory;
+import org.apache.http.conn.socket.PlainSocketFactory;
 import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
-import org.apache.http.impl.conn.SchemeRegistryFactory;
 import org.apache.http.localserver.LocalServerTestBase;
 import org.apache.http.message.BasicHttpRequest;
-import org.apache.http.params.BasicHttpParams;
-import org.apache.http.params.HttpParams;
 import org.apache.http.protocol.BasicHttpContext;
 import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
@@ -114,10 +110,9 @@ public class TestConnectionManagement ex
 
         HttpRequest request = new BasicHttpRequest("GET", uri, HttpVersion.HTTP_1_1);
         HttpContext context = new BasicHttpContext();
-        HttpParams params = new BasicHttpParams();
 
         HttpClientConnection conn = getConnection(mgr, route);
-        mgr.connect(conn, route.getTargetHost(), route.getLocalAddress(), context, params);
+        mgr.connect(conn, route.getTargetHost(), route.getLocalAddress(), context);
 
         context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
         context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, target);
@@ -151,7 +146,7 @@ public class TestConnectionManagement ex
         conn = getConnection(mgr, route);
         Assert.assertFalse("connection should have been closed", conn.isOpen());
 
-        mgr.connect(conn, route.getTargetHost(), route.getLocalAddress(), context, params);
+        mgr.connect(conn, route.getTargetHost(), route.getLocalAddress(), context);
 
         // repeat the communication, no need to prepare the request again
         context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
@@ -203,10 +198,9 @@ public class TestConnectionManagement ex
 
         HttpRequest request = new BasicHttpRequest("GET", uri, HttpVersion.HTTP_1_1);
         HttpContext context = new BasicHttpContext();
-        HttpParams params = new BasicHttpParams();
 
         HttpClientConnection conn = getConnection(mgr, route);
-        mgr.connect(conn, route.getTargetHost(), route.getLocalAddress(), context, params);
+        mgr.connect(conn, route.getTargetHost(), route.getLocalAddress(), context);
 
         context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
         context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, target);
@@ -241,7 +235,7 @@ public class TestConnectionManagement ex
         Assert.assertFalse("connection should have been closed", conn.isOpen());
 
         // repeat the communication, no need to prepare the request again
-        mgr.connect(conn, route.getTargetHost(), route.getLocalAddress(), context, params);
+        mgr.connect(conn, route.getTargetHost(), route.getLocalAddress(), context);
 
         context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
         response = exec.execute(request, conn, context);
@@ -276,7 +270,7 @@ public class TestConnectionManagement ex
         Assert.assertTrue("connection should have been closed", !conn.isOpen());
 
         // repeat the communication, no need to prepare the request again
-        mgr.connect(conn, route.getTargetHost(), route.getLocalAddress(), context, params);
+        mgr.connect(conn, route.getTargetHost(), route.getLocalAddress(), context);
 
         context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
         response = exec.execute(request, conn, context);
@@ -301,10 +295,9 @@ public class TestConnectionManagement ex
         HttpHost target = getServerHttp();
         HttpRoute route = new HttpRoute(target, null, false);
         HttpContext context = new BasicHttpContext();
-        HttpParams params = new BasicHttpParams();
 
         HttpClientConnection conn = getConnection(mgr, route);
-        mgr.connect(conn, route.getTargetHost(), route.getLocalAddress(), context, params);
+        mgr.connect(conn, route.getTargetHost(), route.getLocalAddress(), context);
 
         Assert.assertEquals(1, mgr.getTotalStats().getLeased());
         Assert.assertEquals(1, mgr.getStats(route).getLeased());
@@ -336,16 +329,15 @@ public class TestConnectionManagement ex
     public void testCloseExpiredTTLConnections() throws Exception {
 
         PoolingHttpClientConnectionManager mgr = new PoolingHttpClientConnectionManager(
-                SchemeRegistryFactory.createDefault(), 100, TimeUnit.MILLISECONDS);
+                100, TimeUnit.MILLISECONDS);
         mgr.setMaxTotal(1);
 
         HttpHost target = getServerHttp();
         HttpRoute route = new HttpRoute(target, null, false);
         HttpContext context = new BasicHttpContext();
-        HttpParams params = new BasicHttpParams();
 
         HttpClientConnection conn = getConnection(mgr, route);
-        mgr.connect(conn, route.getTargetHost(), route.getLocalAddress(), context, params);
+        mgr.connect(conn, route.getTargetHost(), route.getLocalAddress(), context);
 
         Assert.assertEquals(1, mgr.getTotalStats().getLeased());
         Assert.assertEquals(1, mgr.getStats(route).getLeased());
@@ -388,13 +380,12 @@ public class TestConnectionManagement ex
         int      rsplen = 8;
         String      uri = "/random/" + rsplen;
         HttpContext context = new BasicHttpContext();
-        HttpParams params = new BasicHttpParams();
 
         HttpRequest request =
             new BasicHttpRequest("GET", uri, HttpVersion.HTTP_1_1);
 
         HttpClientConnection conn = getConnection(mgr, route);
-        mgr.connect(conn, route.getTargetHost(), route.getLocalAddress(), context, params);
+        mgr.connect(conn, route.getTargetHost(), route.getLocalAddress(), context);
 
         context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
         context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, target);
@@ -437,9 +428,9 @@ public class TestConnectionManagement ex
         final CountDownLatch connectLatch = new CountDownLatch(1);
         final StallingSocketFactory stallingSocketFactory = new StallingSocketFactory(
                 connectLatch, WaitPolicy.BEFORE_CONNECT, PlainSocketFactory.getSocketFactory());
-        Scheme scheme = new Scheme("http", 80, stallingSocketFactory);
-        SchemeRegistry registry = new SchemeRegistry();
-        registry.register(scheme);
+        Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create()
+            .register("http", stallingSocketFactory)
+            .build();
 
         final PoolingHttpClientConnectionManager mgr = new PoolingHttpClientConnectionManager(registry);
         mgr.setMaxTotal(1);
@@ -447,7 +438,6 @@ public class TestConnectionManagement ex
         HttpHost target = getServerHttp();
         HttpRoute route = new HttpRoute(target, null, false);
         HttpContext context = new BasicHttpContext();
-        HttpParams params = new BasicHttpParams();
 
         final HttpClientConnection conn = getConnection(mgr, route);
 
@@ -467,7 +457,7 @@ public class TestConnectionManagement ex
         abortingThread.start();
 
         try {
-            mgr.connect(conn, route.getTargetHost(), route.getLocalAddress(), context, params);
+            mgr.connect(conn, route.getTargetHost(), route.getLocalAddress(), context);
             Assert.fail("expected SocketException");
         } catch(SocketException expected) {}
 
@@ -491,9 +481,9 @@ public class TestConnectionManagement ex
         final CountDownLatch connectLatch = new CountDownLatch(1);
         final StallingSocketFactory stallingSocketFactory = new StallingSocketFactory(
                 connectLatch, WaitPolicy.BEFORE_CREATE, PlainSocketFactory.getSocketFactory());
-        Scheme scheme = new Scheme("http", 80, stallingSocketFactory);
-        SchemeRegistry registry = new SchemeRegistry();
-        registry.register(scheme);
+        Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create()
+            .register("http", stallingSocketFactory)
+            .build();
 
         final PoolingHttpClientConnectionManager mgr = new PoolingHttpClientConnectionManager(registry);
         mgr.setMaxTotal(1);
@@ -501,7 +491,6 @@ public class TestConnectionManagement ex
         HttpHost target = getServerHttp();
         HttpRoute route = new HttpRoute(target, null, false);
         HttpContext context = new BasicHttpContext();
-        HttpParams params = new BasicHttpParams();
 
         final HttpClientConnection conn = getConnection(mgr, route);
 
@@ -521,7 +510,7 @@ public class TestConnectionManagement ex
         abortingThread.start();
 
         try {
-            mgr.connect(conn, route.getTargetHost(), route.getLocalAddress(), context, params);
+            mgr.connect(conn, route.getTargetHost(), route.getLocalAddress(), context);
             Assert.fail("IOException expected");
         } catch(IOException expected) {
         }
@@ -546,9 +535,9 @@ public class TestConnectionManagement ex
         final CountDownLatch connectLatch = new CountDownLatch(1);
         final StallingSocketFactory stallingSocketFactory = new StallingSocketFactory(
                 connectLatch, WaitPolicy.AFTER_CONNECT, PlainSocketFactory.getSocketFactory());
-        Scheme scheme = new Scheme("http", 80, stallingSocketFactory);
-        SchemeRegistry registry = new SchemeRegistry();
-        registry.register(scheme);
+        Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create()
+            .register("http", stallingSocketFactory)
+            .build();
 
         final PoolingHttpClientConnectionManager mgr = new PoolingHttpClientConnectionManager(registry);
         mgr.setMaxTotal(1);
@@ -556,7 +545,6 @@ public class TestConnectionManagement ex
         HttpHost target = getServerHttp();
         HttpRoute route = new HttpRoute(target, null, false);
         HttpContext context = new BasicHttpContext();
-        HttpParams params = new BasicHttpParams();
 
         final HttpClientConnection conn = getConnection(mgr, route);
 
@@ -576,7 +564,7 @@ public class TestConnectionManagement ex
         abortingThread.start();
 
         try {
-            mgr.connect(conn, route.getTargetHost(), route.getLocalAddress(), context, params);
+            mgr.connect(conn, route.getTargetHost(), route.getLocalAddress(), context);
             Assert.fail("IOException expected");
         } catch(IOException expected) {
         }
@@ -630,27 +618,30 @@ public class TestConnectionManagement ex
         }
     }
 
-    private static class StallingSocketFactory extends LatchSupport implements SchemeSocketFactory {
+    private static class StallingSocketFactory extends LatchSupport implements ConnectionSocketFactory {
 
-        private final SchemeSocketFactory delegate;
+        private final ConnectionSocketFactory delegate;
 
         public StallingSocketFactory(
                 final CountDownLatch continueLatch,
                 final WaitPolicy waitPolicy,
-                final SchemeSocketFactory delegate) {
+                final ConnectionSocketFactory delegate) {
             super(continueLatch, waitPolicy);
             this.delegate = delegate;
         }
 
         public Socket connectSocket(
+                final int connectTimeout,
                 final Socket sock,
+                final HttpHost host,
                 final InetSocketAddress remoteAddress,
                 final InetSocketAddress localAddress,
-                final HttpParams params) throws IOException, UnknownHostException, ConnectTimeoutException {
+                final HttpContext context) throws IOException, ConnectTimeoutException {
             if(waitPolicy == WaitPolicy.BEFORE_CONNECT)
                 latch();
 
-            Socket socket = delegate.connectSocket(sock, remoteAddress, localAddress, params);
+            Socket socket = delegate.connectSocket(
+                    connectTimeout, sock, host, remoteAddress, localAddress, context);
 
             if(waitPolicy == WaitPolicy.AFTER_CONNECT)
                 latch();
@@ -658,16 +649,13 @@ public class TestConnectionManagement ex
             return socket;
         }
 
-        public Socket createSocket(final HttpParams params) throws IOException {
+        public Socket createSocket(final HttpContext context) throws IOException {
             if(waitPolicy == WaitPolicy.BEFORE_CREATE)
                 latch();
 
-            return delegate.createSocket(params);
+            return delegate.createSocket(context);
         }
 
-        public boolean isSecure(Socket sock) throws IllegalArgumentException {
-            return delegate.isSecure(sock);
-        }
     }
 
     private enum WaitPolicy { BEFORE_CREATE, BEFORE_CONNECT, AFTER_CONNECT, AFTER_OPEN }

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionReuse.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionReuse.java?rev=1414678&r1=1414677&r2=1414678&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionReuse.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionReuse.java Wed Nov 28 13:39:31 2012
@@ -42,9 +42,10 @@ import org.apache.http.impl.client.HttpC
 import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
 import org.apache.http.localserver.LocalTestServer;
 import org.apache.http.localserver.RandomHandler;
-import org.apache.http.protocol.BasicHttpProcessor;
 import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpContext;
+import org.apache.http.protocol.HttpProcessor;
+import org.apache.http.protocol.HttpProcessorBuilder;
 import org.apache.http.protocol.ResponseConnControl;
 import org.apache.http.protocol.ResponseContent;
 import org.apache.http.protocol.ResponseDate;
@@ -67,11 +68,11 @@ public class TestConnectionReuse {
 
     @Test
     public void testReuseOfPersistentConnections() throws Exception {
-        BasicHttpProcessor httpproc = new BasicHttpProcessor();
-        httpproc.addInterceptor(new ResponseDate());
-        httpproc.addInterceptor(new ResponseServer());
-        httpproc.addInterceptor(new ResponseContent());
-        httpproc.addInterceptor(new ResponseConnControl());
+        HttpProcessor httpproc = HttpProcessorBuilder.create()
+            .add(new ResponseDate())
+            .add(new ResponseServer())
+            .add(new ResponseContent())
+            .add(new ResponseConnControl()).build();
 
         this.localServer = new LocalTestServer(httpproc, null);
         this.localServer.register("/random/*", new RandomHandler());
@@ -124,11 +125,11 @@ public class TestConnectionReuse {
 
     @Test
     public void testReuseOfClosedConnections() throws Exception {
-        BasicHttpProcessor httpproc = new BasicHttpProcessor();
-        httpproc.addInterceptor(new ResponseDate());
-        httpproc.addInterceptor(new ResponseServer());
-        httpproc.addInterceptor(new ResponseContent());
-        httpproc.addInterceptor(new AlwaysCloseConn());
+        HttpProcessor httpproc = HttpProcessorBuilder.create()
+            .add(new ResponseDate())
+            .add(new ResponseServer())
+            .add(new ResponseContent())
+            .add(new AlwaysCloseConn()).build();
 
         this.localServer = new LocalTestServer(httpproc, null);
         this.localServer.register("/random/*", new RandomHandler());
@@ -172,11 +173,11 @@ public class TestConnectionReuse {
 
     @Test
     public void testReuseOfAbortedConnections() throws Exception {
-        BasicHttpProcessor httpproc = new BasicHttpProcessor();
-        httpproc.addInterceptor(new ResponseDate());
-        httpproc.addInterceptor(new ResponseServer());
-        httpproc.addInterceptor(new ResponseContent());
-        httpproc.addInterceptor(new ResponseConnControl());
+        HttpProcessor httpproc = HttpProcessorBuilder.create()
+            .add(new ResponseDate())
+            .add(new ResponseServer())
+            .add(new ResponseContent())
+            .add(new ResponseConnControl()).build();
 
         this.localServer = new LocalTestServer(httpproc, null);
         this.localServer.register("/random/*", new RandomHandler());
@@ -220,12 +221,12 @@ public class TestConnectionReuse {
 
     @Test
     public void testKeepAliveHeaderRespected() throws Exception {
-        BasicHttpProcessor httpproc = new BasicHttpProcessor();
-        httpproc.addInterceptor(new ResponseDate());
-        httpproc.addInterceptor(new ResponseServer());
-        httpproc.addInterceptor(new ResponseContent());
-        httpproc.addInterceptor(new ResponseConnControl());
-        httpproc.addInterceptor(new ResponseKeepAlive());
+        HttpProcessor httpproc = HttpProcessorBuilder.create()
+            .add(new ResponseDate())
+            .add(new ResponseServer())
+            .add(new ResponseContent())
+            .add(new ResponseConnControl())
+            .add(new ResponseKeepAlive()).build();
 
         this.localServer = new LocalTestServer(httpproc, null);
         this.localServer.register("/random/*", new RandomHandler());



Mime
View raw message