Package org.apache.http.impl.conn.tsccm

Examples of org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager.shutdown()


        connreq = mgr.requestConnection(new HttpRoute(target), null);
        ManagedClientConnection conn = connreq.getConnection(250, TimeUnit.MILLISECONDS);
       
        mgr.releaseConnection(conn, -1, null);
       
        mgr.shutdown();
    }

    public void testReleaseOnIOException() throws Exception {
       
        localServer.register("/dropdead", new HttpRequestHandler() {
View Full Code Here


        connreq = mgr.requestConnection(new HttpRoute(target), null);
        ManagedClientConnection conn = connreq.getConnection(250, TimeUnit.MILLISECONDS);
       
        mgr.releaseConnection(conn, -1, null);
       
        mgr.shutdown();
    }
   
}
View Full Code Here

        connreq = mgr.requestConnection(new HttpRoute(target), null);
        ManagedClientConnection conn = connreq.getConnection(250, TimeUnit.MILLISECONDS);

        mgr.releaseConnection(conn, -1, null);

        mgr.shutdown();
    }

    @Test
    public void testReleaseOnEntityWriteTo() throws Exception {
        ThreadSafeClientConnManager mgr = createTSCCM(null);
View Full Code Here

        connreq = mgr.requestConnection(new HttpRoute(target), null);
        ManagedClientConnection conn = connreq.getConnection(250, TimeUnit.MILLISECONDS);

        mgr.releaseConnection(conn, -1, null);

        mgr.shutdown();
    }

    @Test
    public void testReleaseOnAbort() throws Exception {
        ThreadSafeClientConnManager mgr = createTSCCM(null);
View Full Code Here

        connreq = mgr.requestConnection(new HttpRoute(target), null);
        ManagedClientConnection conn = connreq.getConnection(250, TimeUnit.MILLISECONDS);

        mgr.releaseConnection(conn, -1, null);

        mgr.shutdown();
    }

    @Test
    public void testReleaseOnIOException() throws Exception {
View Full Code Here

        connreq = mgr.requestConnection(new HttpRoute(target), null);
        ManagedClientConnection conn = connreq.getConnection(250, TimeUnit.MILLISECONDS);

        mgr.releaseConnection(conn, -1, null);

        mgr.shutdown();
    }

}
View Full Code Here

        }

        // Expect some connection in the pool
        Assert.assertTrue(mgr.getConnectionsInPool() > 0);

        mgr.shutdown();
    }

    private static class AlwaysCloseConn implements HttpResponseInterceptor {

        public void process(
View Full Code Here

        data = EntityUtils.toByteArray(response.getEntity());
        Assert.assertEquals("wrong length of fourth response entity",
                     rsplen, data.length);
        // ignore data, but it must be read

        mgr.shutdown();
    }

    @Test
    public void testCloseExpiredConnections() throws Exception {
View Full Code Here

        // Time expired now, connections are destroyed.
        Assert.assertEquals("connectionsInPool", 0, mgr.getConnectionsInPool());
        Assert.assertEquals("connectionsInPool(host)", 0, mgr.getConnectionsInPool(route));

        mgr.shutdown();
    }

    /**
     * Tests releasing connection from #abort method called from the
     * main execution thread while there is no blocking I/O operation.
View Full Code Here

        // the connection is expected to be released back to the manager
        conn = getConnection(mgr, route, 5L, TimeUnit.SECONDS);
        Assert.assertFalse("connection should have been closed", conn.isOpen());

        mgr.releaseConnection(conn, -1, null);
        mgr.shutdown();
    }

    /**
     * Tests GC of an unreferenced connection manager.
     */
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.