Package org.apache.http.conn

Examples of org.apache.http.conn.ClientConnectionManager


    ConnManagerParams.setMaxConnectionsPerRoute(params, connPerRoute);

    SchemeRegistry schemeRegistry = new SchemeRegistry();
    schemeRegistry.register(new Scheme("http", PlainSocketFactory
        .getSocketFactory(), 80));
    ClientConnectionManager cm = new ThreadSafeClientConnManager(params,
        schemeRegistry);
    httpClient = new DefaultHttpClient(cm, params);

    httpClient.setKeepAliveStrategy(new ConnectionKeepAliveStrategy() {
View Full Code Here


  public void setUp() {
    HttpParams params = new BasicHttpParams();
    HttpConnectionParams.setSoTimeout(params, 3000);
      SchemeRegistry registry = new SchemeRegistry();
      registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
      ClientConnectionManager cm = new ThreadSafeClientConnManager(params, registry);
      this.client = new DefaultHttpClient(cm, params);
  }
View Full Code Here

        SchemeRegistry supportedSchemes = new SchemeRegistry();
        supportedSchemes.register(new Scheme(HttpHost.DEFAULT_SCHEME_NAME, PlainSocketFactory.getSocketFactory(), 80));
        supportedSchemes.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));

        ClientConnectionManager connectionManager =
            new ThreadSafeClientConnManager(defaultParameters, supportedSchemes);

        return new DefaultHttpClient(connectionManager, defaultParameters);
    }
View Full Code Here

                this.log.debug("Releasing connection " + conn);
            }
            if (managedConn.getPoolEntry() == null) {
                return; // already released
            }
            ClientConnectionManager manager = managedConn.getManager();
            if (manager != null && manager != this) {
                throw new IllegalStateException("Connection not obtained from this manager");
            }
            synchronized (this) {
                if (this.shutdown) {
View Full Code Here

        // TODO put this values to a configuration way ???
        params.setParameter( ConnManagerPNames.MAX_TOTAL_CONNECTIONS, new Integer( 30 ) );
        params.setParameter( ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE, new ConnPerRouteBean( 30 ) );
        HttpProtocolParams.setVersion( params, HttpVersion.HTTP_1_1 );

        ClientConnectionManager cm = new ThreadSafeClientConnManager( params, schemeRegistry );

        httpClient = new DefaultHttpClient( cm, params );
    }
View Full Code Here

     * Creates a http client with default settings
     * @return a http client with default settings
     */
    private final HttpClient createHttpClient() {

        ClientConnectionManager ccm =
            new ThreadSafeClientConnManager(getParams(), supportedSchemes);

        DefaultHttpClient dhc =
            new DefaultHttpClient(ccm, getParams());
       
View Full Code Here

    @Test
    public void testUsesBackendsConnectionManager() {
        expect(mockBackend.getConnectionManager()).andReturn(
                mockConnectionManager);
        replayMocks();
        ClientConnectionManager result = impl.getConnectionManager();
        verifyMocks();
        Assert.assertSame(result, mockConnectionManager);
    }
View Full Code Here

       
        SchemeRegistry registry = new SchemeRegistry();
        registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
        registry.register(new Scheme("https", sf, 443));
       
        ClientConnectionManager ccm = new ThreadSafeClientConnManager(params, registry);
       
        return new DefaultHttpClient(ccm, params);
      } catch (Exception e) {
        return new DefaultHttpClient();
      }
View Full Code Here

        SchemeRegistry sr = new SchemeRegistry();
        // sr.register(new Scheme("https", 443, ssf));
        sr.register(new Scheme("http", 80, buildSslSocketFactory(sshContext)));

        ClientConnectionManager ccm = new PoolingClientConnectionManager(sr);
        // ClientConnectionManager ccm = new PoolingClientConnectionManager();
        DefaultHttpClient httpClient = new DefaultHttpClient(ccm);

        // HttpParams httpParams = httpClient.getParams();
View Full Code Here

     * Build the agent with the information given before
     *
     * @return a new J4pClient
     */
    public J4pClient build() {
        ClientConnectionManager cm = createClientConnectionManager();
        HttpClient httpClient = new DefaultHttpClient(cm, getHttpParams());
        return new J4pClient(url,httpClient);
    }
View Full Code Here

TOP

Related Classes of org.apache.http.conn.ClientConnectionManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.