hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r824810 - in /httpcomponents/httpclient/trunk/httpclient/src: examples/org/apache/http/examples/conn/ main/java/org/apache/http/impl/client/ test/java/org/apache/http/localserver/
Date Tue, 13 Oct 2009 15:38:58 GMT
Author: olegk
Date: Tue Oct 13 15:38:57 2009
New Revision: 824810

URL: http://svn.apache.org/viewvc?rev=824810&view=rev
Log:
HTTPCLIENT-824: Use synchronized SyncBasicHttpParams instead of non-synchronized BasicHttpParams
where HttpParams can be accessed simultaneously by multiple threads

Modified:
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/conn/ManagerConnectDirect.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/conn/ManagerConnectProxy.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/conn/OperatorConnectDirect.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/conn/OperatorConnectProxy.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/LocalTestServer.java
    httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/ServerTestBase.java

Modified: httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/conn/ManagerConnectDirect.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/conn/ManagerConnectDirect.java?rev=824810&r1=824809&r2=824810&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/conn/ManagerConnectDirect.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/conn/ManagerConnectDirect.java
Tue Oct 13 15:38:57 2009
@@ -27,7 +27,6 @@
 
 package org.apache.http.examples.conn;
 
-
 import org.apache.http.Header;
 import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
@@ -43,14 +42,12 @@
 import org.apache.http.conn.ManagedClientConnection;
 import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
 import org.apache.http.message.BasicHttpRequest;
-import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.HttpParams;
 import org.apache.http.params.HttpProtocolParams;
+import org.apache.http.params.SyncBasicHttpParams;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.BasicHttpContext;
 
-
-
 /**
  * How to open a direct connection using
  * {@link ClientConnectionManager ClientConnectionManager}.
@@ -58,41 +55,38 @@
  * The subsequent message exchange in this example should not
  * be used as a template.
  *
- *
- *
  * @since 4.0
  */
 public class ManagerConnectDirect {
 
     /**
-     * The default parameters.
-     * Instantiated in {@link #setup setup}.
-     */
-    private static HttpParams defaultParameters = null;
-
-    /**
-     * The scheme registry.
-     * Instantiated in {@link #setup setup}.
-     */
-    private static SchemeRegistry supportedSchemes;
-
-
-    /**
      * Main entry point to this example.
      *
      * @param args      ignored
      */
-    public final static void main(String[] args)
-        throws Exception {
+    public final static void main(String[] args) throws Exception {
 
-        final HttpHost target = new HttpHost("jakarta.apache.org", 80, "http");
+        HttpHost target = new HttpHost("www.apache.org", 80, "http");
 
-        setup(); // some general setup
+        // Register the "http" protocol scheme, it is required
+        // by the default operator to look up socket factories.
+        SchemeRegistry supportedSchemes = new SchemeRegistry();
+        SocketFactory sf = PlainSocketFactory.getSocketFactory();
+        supportedSchemes.register(new Scheme("http", sf, 80));
 
-        ClientConnectionManager clcm = createManager();
+        // Prepare parameters.
+        // Since this example doesn't use the full core framework,
+        // only few parameters are actually required.
+        HttpParams params = new SyncBasicHttpParams();
+        HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
+        HttpProtocolParams.setUseExpectContinue(params, false);
+
+        ClientConnectionManager clcm = new ThreadSafeClientConnManager(supportedSchemes);
 
-        HttpRequest req = createRequest(target);
-        HttpContext ctx = createContext();
+        HttpRequest req = new BasicHttpRequest("OPTIONS", "*", HttpVersion.HTTP_1_1);
+        req.addHeader("Host", target.getHostName());
+        
+        HttpContext ctx = new BasicHttpContext();
 
         System.out.println("preparing route to " + target);
         HttpRoute route = new HttpRoute
@@ -103,7 +97,7 @@
         ManagedClientConnection conn = connRequest.getConnection(0, null);
         try {
             System.out.println("opening connection");
-            conn.open(route, ctx, getParams());
+            conn.open(route, ctx, params);
 
             System.out.println("sending request");
             conn.sendRequestHeader(req);
@@ -130,9 +124,9 @@
                 System.out.println("shutting down connection");
                 try {
                     conn.shutdown();
-                } catch (Exception x) {
+                } catch (Exception ex) {
                     System.out.println("problem during shutdown");
-                    x.printStackTrace(System.out);
+                    ex.printStackTrace();
                 }
             }
 
@@ -140,73 +134,7 @@
             clcm.releaseConnection(conn, -1, null);
         }
 
-    } // main
-
-
-    private final static ClientConnectionManager createManager() {
-
-        return new ThreadSafeClientConnManager(supportedSchemes);
-    }
-
-
-    /**
-     * Performs general setup.
-     * This should be called only once.
-     */
-    private final static void setup() {
-
-        // Register the "http" protocol scheme, it is required
-        // by the default operator to look up socket factories.
-        supportedSchemes = new SchemeRegistry();
-        SocketFactory sf = PlainSocketFactory.getSocketFactory();
-        supportedSchemes.register(new Scheme("http", sf, 80));
-
-        // Prepare parameters.
-        // Since this example doesn't use the full core framework,
-        // only few parameters are actually required.
-        HttpParams params = new BasicHttpParams();
-        HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
-        HttpProtocolParams.setUseExpectContinue(params, false);
-        defaultParameters = params;
-
-    } // setup
-
-
-    private final static HttpParams getParams() {
-        return defaultParameters;
-    }
-
-
-    /**
-     * Creates a request to execute in this example.
-     * In a real application, request interceptors should be used
-     * to add the required headers.
-     *
-     * @param target    the target server for the request
-     *
-     * @return  a request without an entity
-     */
-    private final static HttpRequest createRequest(HttpHost target) {
-
-        HttpRequest req = new BasicHttpRequest
-            ("OPTIONS", "*", HttpVersion.HTTP_1_1);
-
-        req.addHeader("Host", target.getHostName());
-
-        return req;
-    }
-
-
-    /**
-     * Creates a context for executing a request.
-     * Since this example doesn't really use the execution framework,
-     * the context can be left empty.
-     *
-     * @return  a new, empty context
-     */
-    private final static HttpContext createContext() {
-        return new BasicHttpContext(null);
     }
 
-} // class ManagerConnectDirect
+}
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/conn/ManagerConnectProxy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/conn/ManagerConnectProxy.java?rev=824810&r1=824809&r2=824810&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/conn/ManagerConnectProxy.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/conn/ManagerConnectProxy.java
Tue Oct 13 15:38:57 2009
@@ -27,7 +27,6 @@
 
 package org.apache.http.examples.conn;
 
-
 import org.apache.http.Header;
 import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
@@ -44,14 +43,12 @@
 import org.apache.http.conn.ssl.SSLSocketFactory;
 import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
 import org.apache.http.message.BasicHttpRequest;
-import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.HttpParams;
 import org.apache.http.params.HttpProtocolParams;
+import org.apache.http.params.SyncBasicHttpParams;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.BasicHttpContext;
 
-
-
 /**
  * How to open a secure connection through a proxy using
  * {@link ClientConnectionManager ClientConnectionManager}.
@@ -59,45 +56,42 @@
  * The message exchange, both subsequently and for tunnelling,
  * should not be used as a template.
  *
- *
- *
  * @since 4.0
  */
 public class ManagerConnectProxy {
 
     /**
-     * The default parameters.
-     * Instantiated in {@link #setup setup}.
-     */
-    private static HttpParams defaultParameters = null;
-
-    /**
-     * The scheme registry.
-     * Instantiated in {@link #setup setup}.
-     */
-    private static SchemeRegistry supportedSchemes;
-
-
-    /**
      * Main entry point to this example.
      *
      * @param args      ignored
      */
-    public final static void main(String[] args)
-        throws Exception {
+    public final static void main(String[] args) throws Exception {
 
         // make sure to use a proxy that supports CONNECT
-        final HttpHost target =
-            new HttpHost("issues.apache.org", 443, "https");
-        final HttpHost proxy =
-            new HttpHost("127.0.0.1", 8666, "http");
+        HttpHost target = new HttpHost("issues.apache.org", 443, "https");
+        HttpHost proxy = new HttpHost("127.0.0.1", 8666, "http");
 
-        setup(); // some general setup
+        // Register the "http" and "https" protocol schemes, they are
+        // required by the default operator to look up socket factories.
+        SchemeRegistry supportedSchemes = new SchemeRegistry();
+        SocketFactory sf = PlainSocketFactory.getSocketFactory();
+        supportedSchemes.register(new Scheme("http", sf, 80));
+        sf = SSLSocketFactory.getSocketFactory();
+        supportedSchemes.register(new Scheme("https", sf, 80));
 
-        ClientConnectionManager clcm = createManager();
+        // Prepare parameters.
+        // Since this example doesn't use the full core framework,
+        // only few parameters are actually required.
+        HttpParams params = new SyncBasicHttpParams();
+        HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
+        HttpProtocolParams.setUseExpectContinue(params, false);
+
+        ClientConnectionManager clcm = new ThreadSafeClientConnManager(supportedSchemes);
+
+        HttpRequest req = new BasicHttpRequest("OPTIONS", "*", HttpVersion.HTTP_1_1);
+        req.addHeader("Host", target.getHostName());
 
-        HttpRequest req = createRequest(target);
-        HttpContext ctx = createContext();
+        HttpContext ctx = new BasicHttpContext();
 
         System.out.println("preparing route to " + target + " via " + proxy);
         HttpRoute route = new HttpRoute
@@ -109,9 +103,12 @@
         ManagedClientConnection conn = connRequest.getConnection(0, null);
         try {
             System.out.println("opening connection");
-            conn.open(route, ctx, getParams());
+            conn.open(route, ctx, params);
 
-            HttpRequest connect = createConnect(target);
+            String authority = target.getHostName() + ":" + target.getPort();
+            HttpRequest connect = new BasicHttpRequest("CONNECT", authority, HttpVersion.HTTP_1_1);
+            connect.addHeader("Host", authority);
+                
             System.out.println("opening tunnel to " + target);
             conn.sendRequestHeader(connect);
             // there is no request entity
@@ -120,7 +117,11 @@
             System.out.println("receiving confirmation for tunnel");
             HttpResponse connected = conn.receiveResponseHeader();
             System.out.println("----------------------------------------");
-            printResponseHeader(connected);
+            System.out.println(connected.getStatusLine());
+            Header[] headers = connected.getAllHeaders();
+            for (int i = 0; i < headers.length; i++) {
+                System.out.println(headers[i]);
+            }
             System.out.println("----------------------------------------");
             int status = connected.getStatusLine().getStatusCode();
             if ((status < 200) || (status > 299)) {
@@ -130,10 +131,10 @@
             System.out.println("receiving response body (ignored)");
             conn.receiveResponseEntity(connected);
 
-            conn.tunnelTarget(false, getParams());
+            conn.tunnelTarget(false, params);
 
             System.out.println("layering secure connection");
-            conn.layerProtocol(ctx, getParams());
+            conn.layerProtocol(ctx, params);
 
             // finally we have the secure connection and can send the request
 
@@ -146,7 +147,11 @@
             HttpResponse rsp = conn.receiveResponseHeader();
 
             System.out.println("----------------------------------------");
-            printResponseHeader(rsp);
+            System.out.println(rsp.getStatusLine());
+            headers = rsp.getAllHeaders();
+            for (int i = 0; i < headers.length; i++) {
+                System.out.println(headers[i]);
+            }
             System.out.println("----------------------------------------");
 
             System.out.println("closing connection");
@@ -158,9 +163,9 @@
                 System.out.println("shutting down connection");
                 try {
                     conn.shutdown();
-                } catch (Exception x) {
+                } catch (Exception ex) {
                     System.out.println("problem during shutdown");
-                    x.printStackTrace(System.out);
+                    ex.printStackTrace();
                 }
             }
 
@@ -168,108 +173,7 @@
             clcm.releaseConnection(conn, -1, null);
         }
 
-    } // main
-
-
-    private final static ClientConnectionManager createManager() {
-
-        return new ThreadSafeClientConnManager(supportedSchemes);
-    }
-
-
-    /**
-     * Performs general setup.
-     * This should be called only once.
-     */
-    private final static void setup() {
-
-        // Register the "http" and "https" protocol schemes, they are
-        // required by the default operator to look up socket factories.
-        supportedSchemes = new SchemeRegistry();
-        SocketFactory sf = PlainSocketFactory.getSocketFactory();
-        supportedSchemes.register(new Scheme("http", sf, 80));
-        sf = SSLSocketFactory.getSocketFactory();
-        supportedSchemes.register(new Scheme("https", sf, 80));
-
-        // Prepare parameters.
-        // Since this example doesn't use the full core framework,
-        // only few parameters are actually required.
-        HttpParams params = new BasicHttpParams();
-        HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
-        HttpProtocolParams.setUseExpectContinue(params, false);
-        defaultParameters = params;
-
-    } // setup
-
-
-    private final static HttpParams getParams() {
-        return defaultParameters;
-    }
-
-
-    /**
-     * Creates a request to tunnel a connection.
-     * In a real application, request interceptors should be used
-     * to add the required headers.
-     *
-     * @param target    the target server for the tunnel
-     *
-     * @return  a CONNECT request without an entity
-     */
-    private final static HttpRequest createConnect(HttpHost target) {
-
-        // see RFC 2817, section 5.2
-        final String authority = target.getHostName()+":"+target.getPort();
-
-        HttpRequest req = new BasicHttpRequest
-            ("CONNECT", authority, HttpVersion.HTTP_1_1);
-
-        req.addHeader("Host", authority);
-
-        return req;
-    }
-
-
-    /**
-     * Creates a request to execute in this example.
-     * In a real application, request interceptors should be used
-     * to add the required headers.
-     *
-     * @param target    the target server for the request
-     *
-     * @return  a request without an entity
-     */
-    private final static HttpRequest createRequest(HttpHost target) {
-
-        HttpRequest req = new BasicHttpRequest
-            ("OPTIONS", "*", HttpVersion.HTTP_1_1);
-
-        req.addHeader("Host", target.getHostName());
-
-        return req;
-    }
-
-
-    /**
-     * Creates a context for executing a request.
-     * Since this example doesn't really use the execution framework,
-     * the context can be left empty.
-     *
-     * @return  a new, empty context
-     */
-    private final static HttpContext createContext() {
-        return new BasicHttpContext(null);
-    }
-
-
-    private final static void printResponseHeader(HttpResponse rsp) {
-
-        System.out.println(rsp.getStatusLine());
-        Header[] headers = rsp.getAllHeaders();
-        for (int i=0; i<headers.length; i++) {
-            System.out.println(headers[i]);
-        }
     }
 
-} // class ManagerConnectProxy
+}
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/conn/OperatorConnectDirect.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/conn/OperatorConnectDirect.java?rev=824810&r1=824809&r2=824810&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/conn/OperatorConnectDirect.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/conn/OperatorConnectDirect.java
Tue Oct 13 15:38:57 2009
@@ -40,13 +40,12 @@
 import org.apache.http.conn.scheme.SocketFactory;
 import org.apache.http.impl.conn.DefaultClientConnectionOperator;
 import org.apache.http.message.BasicHttpRequest;
-import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.HttpParams;
 import org.apache.http.params.HttpProtocolParams;
+import org.apache.http.params.SyncBasicHttpParams;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.BasicHttpContext;
 
-
 /**
  * How to open a direct connection using
  * {@link ClientConnectionOperator ClientConnectionOperator}.
@@ -71,7 +70,7 @@
         // Prepare parameters.
         // Since this example doesn't use the full core framework,
         // only few parameters are actually required.
-        HttpParams params = new BasicHttpParams();
+        HttpParams params = new SyncBasicHttpParams();
         HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
         HttpProtocolParams.setUseExpectContinue(params, false);
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/conn/OperatorConnectProxy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/conn/OperatorConnectProxy.java?rev=824810&r1=824809&r2=824810&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/conn/OperatorConnectProxy.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/conn/OperatorConnectProxy.java
Tue Oct 13 15:38:57 2009
@@ -40,9 +40,9 @@
 import org.apache.http.conn.ssl.SSLSocketFactory;
 import org.apache.http.impl.conn.DefaultClientConnectionOperator;
 import org.apache.http.message.BasicHttpRequest;
-import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.HttpParams;
 import org.apache.http.params.HttpProtocolParams;
+import org.apache.http.params.SyncBasicHttpParams;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.BasicHttpContext;
 
@@ -75,7 +75,7 @@
         // Prepare parameters.
         // Since this example doesn't use the full core framework,
         // only few parameters are actually required.
-        HttpParams params = new BasicHttpParams();
+        HttpParams params = new SyncBasicHttpParams();
         HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
         HttpProtocolParams.setUseExpectContinue(params, false);
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java?rev=824810&r1=824809&r2=824810&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java
Tue Oct 13 15:38:57 2009
@@ -67,10 +67,10 @@
 import org.apache.http.impl.cookie.NetscapeDraftSpecFactory;
 import org.apache.http.impl.cookie.RFC2109SpecFactory;
 import org.apache.http.impl.cookie.RFC2965SpecFactory;
-import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.HttpConnectionParams;
 import org.apache.http.params.HttpParams;
 import org.apache.http.params.HttpProtocolParams;
+import org.apache.http.params.SyncBasicHttpParams;
 import org.apache.http.protocol.BasicHttpContext;
 import org.apache.http.protocol.BasicHttpProcessor;
 import org.apache.http.protocol.HTTP;
@@ -187,7 +187,7 @@
     
     @Override
     protected HttpParams createHttpParams() {
-        HttpParams params = new BasicHttpParams();
+        HttpParams params = new SyncBasicHttpParams();
         HttpProtocolParams.setVersion(params, 
                 HttpVersion.HTTP_1_1);
         HttpProtocolParams.setContentCharset(params, 

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/LocalTestServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/LocalTestServer.java?rev=824810&r1=824809&r2=824810&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/LocalTestServer.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/LocalTestServer.java
Tue Oct 13 15:38:57 2009
@@ -46,10 +46,10 @@
 import org.apache.http.impl.DefaultConnectionReuseStrategy;
 import org.apache.http.impl.DefaultHttpResponseFactory;
 import org.apache.http.impl.DefaultHttpServerConnection;
-import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.CoreConnectionPNames;
 import org.apache.http.params.HttpParams;
 import org.apache.http.params.CoreProtocolPNames;
+import org.apache.http.params.SyncBasicHttpParams;
 import org.apache.http.protocol.BasicHttpProcessor;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.BasicHttpContext;
@@ -64,10 +64,6 @@
 /**
  * Local HTTP server for tests that require one.
  * Based on the <code>ElementalHttpServer</code> example in HttpCore.
- * 
- *
- *
- * <!-- empty lines to avoid 'svn diff' problems -->
  */
 public class LocalTestServer {
 
@@ -178,7 +174,7 @@
      * @return  default parameters
      */
     protected HttpParams newDefaultParams() {
-        HttpParams params = new BasicHttpParams();
+        HttpParams params = new SyncBasicHttpParams();
         params
             .setIntParameter(CoreConnectionPNames.SO_TIMEOUT,
                              60000)

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/ServerTestBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/ServerTestBase.java?rev=824810&r1=824809&r2=824810&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/ServerTestBase.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/localserver/ServerTestBase.java
Tue Oct 13 15:38:57 2009
@@ -36,16 +36,15 @@
 import org.apache.http.conn.scheme.SchemeRegistry;
 import org.apache.http.conn.scheme.SocketFactory;
 import org.apache.http.impl.DefaultHttpClientConnection;
-import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.HttpParams;
 import org.apache.http.params.HttpProtocolParams;
+import org.apache.http.params.SyncBasicHttpParams;
 import org.apache.http.protocol.BasicHttpContext;
 import org.apache.http.protocol.BasicHttpProcessor;
 import org.apache.http.protocol.HttpRequestExecutor;
 import org.apache.http.protocol.RequestConnControl;
 import org.apache.http.protocol.RequestContent;
 
-
 /**
  * Base class for tests using {@link LocalTestServer LocalTestServer}.
  * Note that the test server will be {@link #setUp set up} before each
@@ -104,7 +103,7 @@
     protected void setUp() throws Exception {
 
         if (defaultParams == null) {
-            defaultParams = new BasicHttpParams();
+            defaultParams = new SyncBasicHttpParams();
             HttpProtocolParams.setVersion
                 (defaultParams, HttpVersion.HTTP_1_1);
             HttpProtocolParams.setContentCharset



Mime
View raw message