Package org.apache.http.impl.conn

Examples of org.apache.http.impl.conn.SingleClientConnManager$PoolEntry


  public void ensureConnectionsClosed() {
    assert client != null;
    try {
      //Ensure client is empty
      ApacheHttpClient4Handler clientHandler = ( ( ApacheHttpClient4 ) client ).getClientHandler();
      SingleClientConnManager connectionManager = ( SingleClientConnManager ) clientHandler.getHttpClient().getConnectionManager();
      @Nullable AbstractPooledConnAdapter managedConn = ( AbstractPooledConnAdapter ) Reflection.field( "managedConn" ).ofType( Class.forName( "org.apache.http.impl.conn.SingleClientConnManager$ConnAdapter" ) ).in( connectionManager ).get();
      if ( managedConn != null ) {
        throw new IllegalStateException( "Connection not closed properly: " + managedConn.getRoute() );
      }
    } catch ( ClassNotFoundException e ) {
View Full Code Here


       
        ClientConnectionManager connManager;
        if (multiThreadedHttpClient)
            connManager = new ThreadSafeClientConnManager(registry);
        else
            connManager = new SingleClientConnManager(registry);

        DefaultHttpClient client = new DefaultHttpClient(connManager, httpParams);

        client.getParams().setParameter(AllClientPNames.MAX_REDIRECTS,
                                        new Integer(maxRedirects));
View Full Code Here

    params.setBooleanParameter(HttpConnectionParams.TCP_NODELAY, true); // tcp no delay
    params.setIntParameter(HttpConnectionParams.SO_TIMEOUT,5000)// 5s sock timeout
    params.setIntParameter(HttpConnectionParams.SOCKET_BUFFER_SIZE,1024*1024)// 1mb socket buffer
    params.setBooleanParameter(HttpConnectionParams.SO_REUSEADDR,true)// 5s sock timeout
   
    _httpClientManager = new SingleClientConnManager(sr);
    _httpclient = new DefaultHttpClient(_httpClientManager,params);
   
    if (!_disableHttps){
      _httpclient = HttpsClientDecorator.decorate(_httpclient);
    }
View Full Code Here

  public void ensureConnectionsClosed() {
    assert client != null;
    try {
      //Ensure client is empty
      ApacheHttpClient4Handler clientHandler = ( ( ApacheHttpClient4 ) client ).getClientHandler();
      SingleClientConnManager connectionManager = ( SingleClientConnManager ) clientHandler.getHttpClient().getConnectionManager();
      @Nullable AbstractPooledConnAdapter managedConn = ( AbstractPooledConnAdapter ) Reflection.field( "managedConn" ).ofType( Class.forName( "org.apache.http.impl.conn.SingleClientConnManager$ConnAdapter" ) ).in( connectionManager ).get();
      if ( managedConn != null ) {
        throw new IllegalStateException( "Connection not closed properly: " + managedConn.getRoute() );
      }
    } catch ( ClassNotFoundException e ) {
View Full Code Here

  public void ensureConnectionsClosed() {
    assert client != null;
    try {
      //Ensure client is empty
      ApacheHttpClient4Handler clientHandler = ( ( ApacheHttpClient4 ) client ).getClientHandler();
      SingleClientConnManager connectionManager = ( SingleClientConnManager ) clientHandler.getHttpClient().getConnectionManager();
      @Nullable AbstractPooledConnAdapter managedConn = ( AbstractPooledConnAdapter ) Reflection.field( "managedConn" ).ofType( Class.forName( "org.apache.http.impl.conn.SingleClientConnManager$ConnAdapter" ) ).in( connectionManager ).get();
      if ( managedConn != null ) {
        throw new IllegalStateException( "Connection not closed properly: " + managedConn.getRoute() );
      }
    } catch ( ClassNotFoundException e ) {
View Full Code Here

        }
       
        if(factory != null) {
            connManager = factory.newInstance(params, registry);
        } else {
            connManager = new SingleClientConnManager(getParams(), registry);
        }
       
        return connManager;
    }
View Full Code Here

  public void ensureConnectionsClosed() {
    assert client != null;
    try {
      //Ensure client is empty
      ApacheHttpClient4Handler clientHandler = ( ( ApacheHttpClient4 ) client ).getClientHandler();
      SingleClientConnManager connectionManager = ( SingleClientConnManager ) clientHandler.getHttpClient().getConnectionManager();
      @Nullable AbstractPooledConnAdapter managedConn = ( AbstractPooledConnAdapter ) Reflection.field( "managedConn" ).ofType( Class.forName( "org.apache.http.impl.conn.SingleClientConnManager$ConnAdapter" ) ).in( connectionManager ).get();
      if ( managedConn != null ) {
        throw new IllegalStateException( "Connection not closed properly: " + managedConn.getRoute() );
      }
    } catch ( ClassNotFoundException e ) {
View Full Code Here

                if (maxPooledPerRoute == 0) maxPooledPerRoute = connectionPoolSize;
                tcm.setDefaultMaxPerRoute(maxPooledPerRoute);
                cm = tcm;

            } else {
                cm = new SingleClientConnManager(registry);
            }
            BasicHttpParams params = new BasicHttpParams();
            if (socketTimeout > -1)
            {
                HttpConnectionParams.setSoTimeout(params, (int) socketTimeoutUnits.toMillis(socketTimeout));
View Full Code Here

                if (maxPooledPerRoute == 0) maxPooledPerRoute = connectionPoolSize;
                tcm.setDefaultMaxPerRoute(maxPooledPerRoute);
                cm = tcm;

            } else {
                cm = new SingleClientConnManager(registry);
            }
            BasicHttpParams params = new BasicHttpParams();
            if (socketTimeout > -1)
            {
                HttpConnectionParams.setSoTimeout(params, (int) socketTimeoutUnits.toMillis(socketTimeout));
View Full Code Here

       
        CountDownLatch releaseLatch = new CountDownLatch(1);
        SchemeRegistry registry = new SchemeRegistry();
        registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
       
        SingleClientConnManager conMan = new SingleClientConnManager(new BasicHttpParams(), registry);
        final AtomicReference<Throwable> throwableRef = new AtomicReference<Throwable>();
        final CountDownLatch getLatch = new CountDownLatch(1);
        final DefaultHttpClient client = new DefaultHttpClient(conMan, new BasicHttpParams());
        final HttpContext context = new BasicHttpContext();
        final HttpGet httpget = new CustomGet("a", releaseLatch);
View Full Code Here

TOP

Related Classes of org.apache.http.impl.conn.SingleClientConnManager$PoolEntry

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.