Examples of requestConnection()


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

        // Expect one connection in the pool
        Assert.assertEquals(1, mgr.getConnectionsInPool());

        // Make sure one connection is available
        connreq = mgr.requestConnection(new HttpRoute(target), null);
        ManagedClientConnection conn = connreq.getConnection(250, TimeUnit.MILLISECONDS);

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

        mgr.shutdown();
View Full Code Here

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

        HttpGet httpget = new HttpGet("/random/20000");
        HttpHost target = getServerHttp();

        HttpResponse response = client.execute(target, httpget);

        ClientConnectionRequest connreq = mgr.requestConnection(new HttpRoute(target), null);
        try {
            connreq.getConnection(250, TimeUnit.MILLISECONDS);
            Assert.fail("ConnectionPoolTimeoutException should have been thrown");
        } catch (ConnectionPoolTimeoutException expected) {
        }
View Full Code Here

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

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

        // Make sure one connection is available
        connreq = mgr.requestConnection(new HttpRoute(target), null);
        ManagedClientConnection conn = connreq.getConnection(250, TimeUnit.MILLISECONDS);

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

        mgr.shutdown();
View Full Code Here

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

        HttpGet httpget = new HttpGet("/dropdead");
        HttpHost target = getServerHttp();

        HttpResponse response = client.execute(target, httpget);

        ClientConnectionRequest connreq = mgr.requestConnection(new HttpRoute(target), null);
        try {
            connreq.getConnection(250, TimeUnit.MILLISECONDS);
            Assert.fail("ConnectionPoolTimeoutException should have been thrown");
        } catch (ConnectionPoolTimeoutException expected) {
        }
View Full Code Here

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

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

        // Make sure one connection is available
        connreq = mgr.requestConnection(new HttpRoute(target), null);
        ManagedClientConnection conn = connreq.getConnection(250, TimeUnit.MILLISECONDS);

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

        mgr.shutdown();
View Full Code Here

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

        HttpHost target = new HttpHost("www.test.invalid", 80, "http");
        HttpRoute route = new HttpRoute(target, null, false);

        // get the only connection, then start an extra thread
        ManagedClientConnection conn = getConnection(mgr, route, 1L, TimeUnit.MILLISECONDS);
        ClientConnectionRequest request = mgr.requestConnection(route, null);
        GetConnThread gct = new GetConnThread(request, route, 0L); // no timeout
        gct.start();
        Thread.sleep(100); // give extra thread time to block

        request.abortRequest();
View Full Code Here

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

        HttpHost target = new HttpHost("www.test.invalid", 80, "http");
        HttpRoute route = new HttpRoute(target, null, false);

        // get the only connection, then start an extra thread
        ManagedClientConnection conn = getConnection(mgr, route, 1L, TimeUnit.MILLISECONDS);
        ClientConnectionRequest request = mgr.requestConnection(route, null);
        request.abortRequest();

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

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

        HttpGet httpget = new HttpGet("/random/20000");
        HttpHost target = getServerHttp();
       
        HttpResponse response = client.execute(target, httpget);

        ClientConnectionRequest connreq = mgr.requestConnection(new HttpRoute(target), null);
        try {
            connreq.getConnection(250, TimeUnit.MILLISECONDS);
            fail("ConnectionPoolTimeoutException should have been thrown");
        } catch (ConnectionPoolTimeoutException expected) {
        }
View Full Code Here

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

       
        // Expect one connection in the pool
        assertEquals(1, mgr.getConnectionsInPool());

        // Make sure one connection is available
        connreq = mgr.requestConnection(new HttpRoute(target), null);
        ManagedClientConnection conn = connreq.getConnection(250, TimeUnit.MILLISECONDS);
       
        mgr.releaseConnection(conn, -1, null);
       
        mgr.shutdown();
View Full Code Here

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

        HttpGet httpget = new HttpGet("/random/20000");
        HttpHost target = getServerHttp();
       
        HttpResponse response = client.execute(target, httpget);

        ClientConnectionRequest connreq = mgr.requestConnection(new HttpRoute(target), null);
        try {
            connreq.getConnection(250, TimeUnit.MILLISECONDS);
            fail("ConnectionPoolTimeoutException should have been thrown");
        } catch (ConnectionPoolTimeoutException expected) {
        }
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.