Examples of HttpRoute


Examples of org.apache.http.conn.routing.HttpRoute

     * Obtains the default route to the local test server.
     *
     * @return the default route to the local test server
     */
    protected HttpRoute getDefaultRoute() {
        return new HttpRoute(getServerHttp());
    }
View Full Code Here

Examples of org.apache.http.conn.routing.HttpRoute

    public void testGetConnection()
            throws InterruptedException, ConnectionPoolTimeoutException {
        ThreadSafeClientConnManager mgr = createTSCCM(null, null);

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

        ManagedClientConnection conn = getConnection(mgr, route);
        assertNotNull(conn);
        assertNull(conn.getRoute());
        assertFalse(conn.isOpen());
View Full Code Here

Examples of org.apache.http.conn.routing.HttpRoute

        ConnManagerParams.setMaxTotalConnections(params, 2);

        ThreadSafeClientConnManager mgr = createTSCCM(params, null);

        HttpHost target1 = new HttpHost("www.test1.invalid", 80, "http");
        HttpRoute route1 = new HttpRoute(target1, null, false);
        HttpHost target2 = new HttpHost("www.test2.invalid", 80, "http");
        HttpRoute route2 = new HttpRoute(target2, null, false);

        ManagedClientConnection conn1 = getConnection(mgr, route1);
        assertNotNull(conn1);
        ManagedClientConnection conn2 = getConnection(mgr, route2);
        assertNotNull(conn2);
View Full Code Here

Examples of org.apache.http.conn.routing.HttpRoute


    public void testMaxConnPerHost() throws Exception {

        HttpHost target1 = new HttpHost("www.test1.invalid", 80, "http");
        HttpRoute route1 = new HttpRoute(target1, null, false);
        HttpHost target2 = new HttpHost("www.test2.invalid", 80, "http");
        HttpRoute route2 = new HttpRoute(target2, null, false);
        HttpHost target3 = new HttpHost("www.test3.invalid", 80, "http");
        HttpRoute route3 = new HttpRoute(target3, null, false);
       
        HttpParams params = createDefaultParams();
        ConnManagerParams.setMaxTotalConnections(params, 100);
       
        ConnPerRouteBean connPerRoute = new ConnPerRouteBean(1);
View Full Code Here

Examples of org.apache.http.conn.routing.HttpRoute

        ConnManagerParams.setMaxTotalConnections(params, 3);

        ThreadSafeClientConnManager mgr = createTSCCM(params, null);

        HttpHost target1 = new HttpHost("www.test1.invalid", 80, "http");
        HttpRoute route1 = new HttpRoute(target1, null, false);
        HttpHost target2 = new HttpHost("www.test2.invalid", 80, "http");
        HttpRoute route2 = new HttpRoute(target2, null, false);
        HttpHost target3 = new HttpHost("www.test3.invalid", 80, "http");
        HttpRoute route3 = new HttpRoute(target3, null, false);

        // the first three allocations should pass
        ManagedClientConnection conn1 =
            getConnection(mgr, route1, 10L, TimeUnit.MILLISECONDS);
        ManagedClientConnection conn2 =
View Full Code Here

Examples of org.apache.http.conn.routing.HttpRoute

            throws InterruptedException, ConnectionPoolTimeoutException {
       
        ThreadSafeClientConnManager mgr = createTSCCM(null, null);

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

        ManagedClientConnection conn = getConnection(mgr, route);

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

Examples of org.apache.http.conn.routing.HttpRoute

        ConnManagerParams.setMaxTotalConnections(params, 1);

        ThreadSafeClientConnManager mgr = createTSCCM(params, null);

        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
        // on shutdown, the extra thread should get an exception

        ManagedClientConnection conn =
View Full Code Here

Examples of org.apache.http.conn.routing.HttpRoute

        ConnManagerParams.setMaxTotalConnections(params, 1);

        ThreadSafeClientConnManager mgr = createTSCCM(params, null);

        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);
        GetConnThread gct = new GetConnThread(mgr, route, 0L); // no timeout
View Full Code Here

Examples of org.apache.http.conn.routing.HttpRoute

        ConnManagerParams.setMaxTotalConnections(params, 1);

        ThreadSafeClientConnManager mgr = createTSCCM(params, null);

        HttpHost target1 = new HttpHost("www.test1.invalid", 80, "http");
        HttpRoute route1 = new HttpRoute(target1, null, false);
        HttpHost target2 = new HttpHost("www.test2.invalid", 80, "http");
        HttpRoute route2 = new HttpRoute(target2, null, false);

        // get the only connection, then start two extra threads
        ManagedClientConnection conn =
            getConnection(mgr, route1, 1L, TimeUnit.MILLISECONDS);
        GetConnThread gct1 = new GetConnThread(mgr, route1, 1000L);
View Full Code Here

Examples of org.apache.http.conn.routing.HttpRoute

        ConnManagerParams.setMaxTotalConnections(params, 1);

        ThreadSafeClientConnManager mgr = createTSCCM(params, null);

        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
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.