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

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


        // 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 {
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 {
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;
View Full Code Here

        ManagedClientConnection conn = getConnection(mgr, route);
        Assert.assertNotNull(conn);
        Assert.assertNull(conn.getRoute());
        Assert.assertFalse(conn.isOpen());

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

        try {
            getConnection(mgr, null);
        } finally {
            mgr.shutdown();
View Full Code Here

        } catch (ConnectionPoolTimeoutException e) {
            // expected
        }

        // release one of the connections
        mgr.releaseConnection(conn2, -1, null);
        conn2 = null;

        // there should be a connection available now
        try {
            getConnection(mgr, route2, 100L, TimeUnit.MILLISECONDS);
View Full Code Here

        }


        // check releaseConnection with invalid arguments
        try {
            mgr.releaseConnection(null, -1, null);
            Assert.fail("null connection adapter not detected");
        } catch (IllegalArgumentException iax) {
            // expected
        }
        try {
View Full Code Here

            Assert.fail("null connection adapter not detected");
        } catch (IllegalArgumentException iax) {
            // expected
        }
        try {
            mgr.releaseConnection(new ClientConnAdapterMockup(null), -1, null);
            Assert.fail("foreign connection adapter not detected");
        } catch (IllegalArgumentException iax) {
            // expected
        }
View Full Code Here

        } catch (ConnectionPoolTimeoutException e) {
            // expected
        }

        // now release one and check that exactly that one can be obtained then
        mgr.releaseConnection(conn2, -1, null);
        conn2 = null;
        try {
            getConnection(mgr, route1, 10L, TimeUnit.MILLISECONDS);
            Assert.fail("ConnectionPoolTimeoutException should have been thrown");
        } catch (ConnectionPoolTimeoutException e) {
View Full Code Here

        Assert.assertEquals("connectionsInPool",
                     mgr.getConnectionsInPool(), 1);
        Assert.assertEquals("connectionsInPool(host)",
                     mgr.getConnectionsInPool(route), 1);
        mgr.releaseConnection(conn, -1, null);

        Assert.assertEquals("connectionsInPool",
                     mgr.getConnectionsInPool(), 1);
        Assert.assertEquals("connectionsInPool(host)",
                     mgr.getConnectionsInPool(route), 1);
View Full Code Here

        mgr.shutdown();

        // First release the connection. If the manager keeps working
        // despite the shutdown, this will deblock the extra thread.
        // The release itself should turn into a no-op, without exception.
        mgr.releaseConnection(conn, -1, null);


        gct.join(10000);
        Assert.assertNull("thread should not have obtained connection",
                   gct.getConnection());
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.