Package org.apache.http.impl.conn

Examples of org.apache.http.impl.conn.PoolingHttpClientConnectionManager.shutdown()


        // Time expired now, connections are destroyed.
        Assert.assertEquals(0, mgr.getTotalStats().getAvailable());
        Assert.assertEquals(0, mgr.getStats(route).getAvailable());

        mgr.shutdown();
    }

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


        // TTL expired now, connections are destroyed.
        Assert.assertEquals(0, mgr.getTotalStats().getAvailable());
        Assert.assertEquals(0, mgr.getStats(route).getAvailable());

        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, null, -1, null);
        mgr.shutdown();
    }

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

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

        mgr.releaseConnection(conn2, null, -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
        final HttpClientConnection conn2 = getConnection(mgr, route, 5L, TimeUnit.SECONDS);
        Assert.assertFalse("connection should have been closed", conn2.isOpen());

        mgr.releaseConnection(conn2, null, -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
        final HttpClientConnection conn2 = getConnection(mgr, route, 5L, TimeUnit.SECONDS);
        Assert.assertFalse("connection should have been closed", conn2.isOpen());

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

    static class LatchSupport {

        private final CountDownLatch continueLatch;
View Full Code Here

        }

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

        mgr.shutdown();
    }

    private static class AlwaysCloseConn implements HttpResponseInterceptor {

        public void process(
View Full Code Here

        }

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

        mgr.shutdown();
    }

    @Test
    public void testReuseOfAbortedConnections() throws Exception {
        final HttpProcessor httpproc = HttpProcessorBuilder.create()
View Full Code Here

        }

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

        mgr.shutdown();
    }

    @Test
    public void testKeepAliveHeaderRespected() throws Exception {
        final HttpProcessor httpproc = HttpProcessorBuilder.create()
View Full Code Here

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


        mgr.shutdown();
    }

    private static class WorkerThread extends Thread {

        private final URI requestURI;
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.