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

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


            Assert.fail("foreign connection adapter not detected");
        } catch (IllegalArgumentException iax) {
            // expected
        }

        mgr.shutdown();
    }

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


            Assert.fail("ConnectionPoolTimeoutException should have been thrown");
        } catch (ConnectionPoolTimeoutException e) {
            // expected
        }

        mgr.shutdown();
    }

    @Test
    public void testDeleteClosedConnections()
            throws InterruptedException, ConnectionPoolTimeoutException {
View Full Code Here

        Assert.assertEquals("connectionsInPool",
                     mgr.getConnectionsInPool(), 0);
        Assert.assertEquals("connectionsInPool(host)",
                     mgr.getConnectionsInPool(route), 0);

        mgr.shutdown();
    }

    @Test
    public void testShutdown() throws Exception {
        // 3.x: TestHttpConnectionManager.testShutdown
View Full Code Here

        GetConnThread gct = new GetConnThread(mgr, route, 0L); // no timeout
        gct.start();
        Thread.sleep(100); // give extra thread time to block


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

        mgr.releaseConnection(conn, -1, null);
        // this time: no exception
        conn = getConnection(mgr, route, 10L, TimeUnit.MILLISECONDS);
        Assert.assertNotNull("should have gotten a connection", conn);

        mgr.shutdown();
    }

    @Test
    public void testReusePreference() throws Exception {
        // 3.x: TestHttpConnectionManager.testHostReusePreference
View Full Code Here

        Assert.assertNotNull("thread 1 should have gotten a connection",
                      gct1.getConnection());
        Assert.assertNull   ("thread 2 should NOT have gotten a connection",
                      gct2.getConnection());

        mgr.shutdown();
    }

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

        mgr.releaseConnection(conn, -1, null);
        // this time: no exception
        conn = getConnection(mgr, route, 10L, TimeUnit.MILLISECONDS);
        Assert.assertNotNull("should have gotten a connection", conn);

        mgr.shutdown();
    }

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

        mgr.releaseConnection(conn, -1, null);
        // this time: no exception
        conn = getConnection(mgr, route, 10L, TimeUnit.MILLISECONDS);
        Assert.assertNotNull("should have gotten a connection", conn);

        mgr.shutdown();
    }

}
View Full Code Here

                          threads[i].getResponseData());
            Assert.assertEquals("wrong length of data in thread" + i, rsplen,
                         threads[i].getResponseData().length);
        }

        mgr.shutdown();
    }

    private static ManagedClientConnection getConnection(
            final ClientConnectionManager mgr,
            final HttpRoute route,
View Full Code Here

        Assert.assertEquals("wrong length of third response entity",
                     rsplen, data.length);
        // ignore data, but it must be read

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

    /**
     * Tests releasing with time limits.
     */
 
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.