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

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


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

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

    @Test
    public void testAbortBeforeSocketCreate() throws Exception {
        final CountDownLatch connectLatch = new CountDownLatch(1);
View Full Code Here


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

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

    @Test
    public void testAbortAfterSocketConnect() throws Exception {
        final CountDownLatch connectLatch = new CountDownLatch(1);
View Full Code Here

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

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

    @Test
    public void testAbortAfterOperatorOpen() throws Exception {
        final CountDownLatch connectLatch = new CountDownLatch(1);
View Full Code Here

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

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

    private static class LatchSupport {
        private final CountDownLatch continueLatch;
        private final CountDownLatch waitLatch = new CountDownLatch(1);
View Full Code Here

        }

        // Expect zero connections in the pool
        Assert.assertEquals(0, mgr.getConnectionsInPool());

        mgr.shutdown();
    }

    @Test
    public void testReuseOfAbortedConnections() throws Exception {
        BasicHttpProcessor httpproc = new BasicHttpProcessor();
View Full Code Here

        }

        // Expect zero connections in the pool
        Assert.assertEquals(0, mgr.getConnectionsInPool());

        mgr.shutdown();
    }

    @Test
    public void testKeepAliveHeaderRespected() throws Exception {
        BasicHttpProcessor httpproc = new BasicHttpProcessor();
View Full Code Here

        Assert.assertEquals(1, mgr.getConnectionsInPool());
        Assert.assertEquals(2, localServer.getAcceptedConnectionCount());


        mgr.shutdown();
    }

    private static class WorkerThread extends Thread {

        private final URI requestURI;
View Full Code Here

    public void testConstructor() {
        SchemeRegistry schreg = createSchemeRegistry();

        ThreadSafeClientConnManager mgr = new ThreadSafeClientConnManager(schreg);
        Assert.assertNotNull(mgr);
        mgr.shutdown();
    }

    @Test(expected=IllegalArgumentException.class)
    public void testIllegalConstructor() {
        new ThreadSafeClientConnManager(null);
View Full Code Here

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

        try {
            getConnection(mgr, null);
        } finally {
            mgr.shutdown();
        }
    }

    // testTimeout in 3.x TestHttpConnectionManager is redundant
    // several other tests here rely on timeout behavior
View Full Code Here

            getConnection(mgr, route2, 100L, TimeUnit.MILLISECONDS);
        } catch (ConnectionPoolTimeoutException cptx) {
            Assert.fail("connection should have been available: " + cptx);
        }

        mgr.shutdown();
    }

    @Test
    public void testMaxConnPerHost() throws Exception {
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.