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

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


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

        mgr.shutdown();
    }   


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


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

        mgr.shutdown();
    }


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

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

        mgr.shutdown();
    }

    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);
        assertNotNull("should have gotten a connection", conn);

        mgr.shutdown();
    }



    public void testReusePreference() throws Exception {
View Full Code Here

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

        mgr.shutdown();
    }
   
    public void testAbortAfterRequestStarts() throws Exception {
        HttpParams params = createDefaultParams();
        ConnManagerParams.setMaxTotalConnections(params, 1);
View Full Code Here

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

        mgr.shutdown();
    }
   
    public void testAbortBeforeRequestStarts() throws Exception {
        HttpParams params = createDefaultParams();
        ConnManagerParams.setMaxTotalConnections(params, 1);
View Full Code Here

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

        mgr.shutdown();
    }

} // class TestTSCCMNoServer
View Full Code Here

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

        mgr.shutdown();
    }

    private static class AlwaysCloseConn implements HttpResponseInterceptor {

        public void process(
View Full Code Here

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

        mgr.shutdown();
    }

    public void testReuseOfAbortedConnections() throws Exception {
        BasicHttpProcessor httpproc = new BasicHttpProcessor();
        httpproc.addInterceptor(new ResponseDate());
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.