Examples of HttpHost


Examples of org.apache.http.HttpHost

        HttpRoute  route   = new HttpRoute(TARGET1, null, proxies, true,
                                           TunnelType.PLAIN, LayerType.PLAIN);
        assertEquals("A: hop count", 1, route.getHopCount());
        assertEquals("A: hop 0", TARGET1, route.getHopTarget(0));
        try {
            HttpHost beyond = route.getHopTarget(1);
            fail("A: hop 1 is " + beyond);
        } catch (IllegalArgumentException iax) {
            // expected
        }
        try {
            HttpHost before = route.getHopTarget(-1);
            fail("A: hop -1 is " + before);
        } catch (IllegalArgumentException iax) {
            // expected
        }


        proxies = new HttpHost[]{ PROXY3 };
        route   = new HttpRoute(TARGET1, LOCAL62, proxies, false,
                                TunnelType.TUNNELLED, LayerType.PLAIN);
        assertEquals("B: hop count", 2, route.getHopCount());
        assertEquals("B: hop 0", PROXY3, route.getHopTarget(0));
        assertEquals("B: hop 1", TARGET1, route.getHopTarget(1));
        try {
            HttpHost beyond = route.getHopTarget(2);
            fail("B: hop 2 is " + beyond);
        } catch (IllegalArgumentException iax) {
            // expected
        }
        try {
            HttpHost before = route.getHopTarget(-2);
            fail("B: hop -2 is " + before);
        } catch (IllegalArgumentException iax) {
            // expected
        }


        proxies = new HttpHost[]{ PROXY3, PROXY1, PROXY2 };
        route   = new HttpRoute(TARGET1, LOCAL42, proxies, false,
                                TunnelType.PLAIN, LayerType.LAYERED);
        assertEquals("C: hop count", 4, route.getHopCount());
        assertEquals("C: hop 0", PROXY3 , route.getHopTarget(0));
        assertEquals("C: hop 1", PROXY1 , route.getHopTarget(1));
        assertEquals("C: hop 2", PROXY2 , route.getHopTarget(2));
        assertEquals("C: hop 3", TARGET1, route.getHopTarget(3));
        try {
            HttpHost beyond = route.getHopTarget(4);
            fail("C: hop 4 is " + beyond);
        } catch (IllegalArgumentException iax) {
            // expected
        }
        try {
            HttpHost before = route.getHopTarget(Integer.MIN_VALUE);
            fail("C: hop -<min> is " + before);
        } catch (IllegalArgumentException iax) {
            // expected
        }
    }
View Full Code Here

Examples of org.apache.http.HttpHost

            case HttpRouteDirector.TUNNEL_PROXY: {
                final int hops = rt.getHopCount(); // before tunnelling
                // we assume an insecure tunnel
                final boolean  sec = false;
                final HttpHost pxy = r.getHopTarget(hops-1);
                rt.tunnelProxy(pxy, sec);
                // Since we're tunnelling to a proxy and not the target,
                // the 'tunelling' flag is false: no end-to-end tunnel.
                checkCTLS(rt, true, false, false, sec);
                assertEquals("wrong hop count "+msg,
View Full Code Here

Examples of org.apache.http.HttpHost

        int requestCount = 5;
       
        int port = this.localServer.getServicePort();
        this.localServer.register("*", new SimpleService());

        HttpHost target = new HttpHost("localhost", port);
       
        HttpParams params = defaultParams.copy();
        ConnManagerParams.setMaxTotalConnections(params, workerCount);
        ConnManagerParams.setMaxConnectionsPerRoute(params,
                new ConnPerRouteBean(workerCount));
View Full Code Here

Examples of org.apache.http.HttpHost

        HttpRoutePlanner hrp =
            new ProxySelectorRoutePlanner(createSchemeRegistry(),
                                          new ProxySelectorMockup(null));

        HttpHost target =
            new HttpHost("www.test.invalid", 80, "http");
        HttpRequest request =
            new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);

        HttpRoute route = hrp.determineRoute(target, request, null);
View Full Code Here

Examples of org.apache.http.HttpHost

        HttpRoutePlanner hrp =
            new ProxySelectorRoutePlanner(createSchemeRegistry(),
                                          new ProxySelectorMockup(proxies));

        HttpHost target =
            new HttpHost("www.test.invalid", 80, "http");
        HttpRequest request =
            new BasicHttpRequest("GET", "/", HttpVersion.HTTP_1_1);

        HttpRoute route = hrp.determineRoute(target, request, null);
View Full Code Here

Examples of org.apache.http.HttpHost

            (mgrpar, COUNT/2);
        ConnManagerParams.setMaxConnectionsPerRoute
            (mgrpar, new ConnPerRouteBean(COUNT/2));
        ThreadSafeClientConnManager mgr = createTSCCM(mgrpar, null);

        final HttpHost target = getServerHttp();
        final HttpRoute route = new HttpRoute(target, null, false);
        final int      rsplen = 8;
        final String      uri = "/random/" + rsplen;

        ExecReqThread[] threads = new ExecReqThread [COUNT];
View Full Code Here

Examples of org.apache.http.HttpHost

        HttpParams mgrpar = defaultParams.copy();
        ConnManagerParams.setMaxTotalConnections(mgrpar, 1);

        ThreadSafeClientConnManager mgr = createTSCCM(mgrpar, null);

        final HttpHost target = getServerHttp();
        final HttpRoute route = new HttpRoute(target, null, false);
        final int      rsplen = 8;
        final String      uri = "/random/" + rsplen;

        HttpRequest request =
View Full Code Here

Examples of org.apache.http.HttpHost

        HttpParams mgrpar = defaultParams.copy();
        ConnManagerParams.setMaxTotalConnections(mgrpar, 1);

        ThreadSafeClientConnManager mgr = createTSCCM(mgrpar, null);

        final HttpHost target = getServerHttp();
        final HttpRoute route = new HttpRoute(target, null, false);
        final int      rsplen = 8;
        final String      uri = "/random/" + rsplen;

        HttpRequest request =
View Full Code Here

Examples of org.apache.http.HttpHost

        HttpParams mgrpar = defaultParams.copy();
        ConnManagerParams.setMaxTotalConnections(mgrpar, 1);

        ThreadSafeClientConnManager mgr = createTSCCM(mgrpar, null);

        final HttpHost target = getServerHttp();
        final HttpRoute route = new HttpRoute(target, null, false);

        ManagedClientConnection conn = getConnection(mgr, route);
        conn.open(route, httpContext, defaultParams);
View Full Code Here

Examples of org.apache.http.HttpHost

        HttpParams mgrpar = defaultParams.copy();
        ConnManagerParams.setMaxTotalConnections(mgrpar, 1);

        ThreadSafeClientConnManager mgr = createTSCCM(mgrpar, null);

        final HttpHost target = getServerHttp();
        final HttpRoute route = new HttpRoute(target, null, false);
        final int      rsplen = 8;
        final String      uri = "/random/" + rsplen;

        HttpRequest request =
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.