Examples of SchemeRegistry


Examples of org.apache.http.conn.scheme.SchemeRegistry

            HttpProtocolParams.setUseExpectContinue
                (defaultParams, false);
        }

        if (supportedSchemes == null) {
            supportedSchemes = new SchemeRegistry();
            SocketFactory sf = PlainSocketFactory.getSocketFactory();
            supportedSchemes.register(new Scheme("http", sf, 80));
        }

        if (httpProcessor == null) {
View Full Code Here

Examples of org.apache.http.conn.scheme.SchemeRegistry

     *
     * @return the default scheme registry
     */
    public SchemeRegistry createSchemeRegistry() {

        SchemeRegistry schreg = new SchemeRegistry();
        SocketFactory sf = PlainSocketFactory.getSocketFactory();
        schreg.register(new Scheme("http", sf, 80));

        return schreg;
    }
View Full Code Here

Examples of org.apache.http.conn.scheme.SchemeRegistry

    }


    public void testConstructor() {
        HttpParams     params = createDefaultParams();
        SchemeRegistry schreg = createSchemeRegistry();

        ThreadSafeClientConnManager mgr =
            new ThreadSafeClientConnManager(params, schreg);
        assertNotNull(mgr);
        mgr.shutdown();
View Full Code Here

Examples of org.apache.http.conn.scheme.SchemeRegistry

        public HttpParams getParams() {
            throw new UnsupportedOperationException("just a mockup");
        }

        public SchemeRegistry getSchemeRegistry() {
            SchemeRegistry registry = new SchemeRegistry();
            registry.register(new Scheme("http", new SocketFactoryMockup(null), 80));
            return registry;
        }
View Full Code Here

Examples of org.apache.http.conn.scheme.SchemeRegistry

        HttpConnectionParams.setStaleCheckingEnabled(params, false);
        ConnManagerParams.setMaxTotalConnections(params, 5);
        ConnManagerParams.setMaxConnectionsPerRoute(params,
                new ConnPerRouteBean(5));
       
        SchemeRegistry supportedSchemes = new SchemeRegistry();
        SocketFactory sf = PlainSocketFactory.getSocketFactory();
        supportedSchemes.register(new Scheme("http", sf, 80));
       
        ThreadSafeClientConnManager mgr = new ThreadSafeClientConnManager(
                params, supportedSchemes);

        DefaultHttpClient client = new DefaultHttpClient(mgr, params);
View Full Code Here

Examples of org.apache.http.conn.scheme.SchemeRegistry

        HttpConnectionParams.setStaleCheckingEnabled(params, false);
        ConnManagerParams.setMaxTotalConnections(params, 5);
        ConnManagerParams.setMaxConnectionsPerRoute(params,
                new ConnPerRouteBean(5));
       
        SchemeRegistry supportedSchemes = new SchemeRegistry();
        SocketFactory sf = PlainSocketFactory.getSocketFactory();
        supportedSchemes.register(new Scheme("http", sf, 80));
       
        ThreadSafeClientConnManager mgr = new ThreadSafeClientConnManager(
                params, supportedSchemes);

        DefaultHttpClient client = new DefaultHttpClient(mgr, params);
View Full Code Here

Examples of org.apache.http.conn.scheme.SchemeRegistry

        HttpConnectionParams.setStaleCheckingEnabled(params, false);
        ConnManagerParams.setMaxTotalConnections(params, 5);
        ConnManagerParams.setMaxConnectionsPerRoute(params,
                new ConnPerRouteBean(5));
       
        SchemeRegistry supportedSchemes = new SchemeRegistry();
        SocketFactory sf = PlainSocketFactory.getSocketFactory();
        supportedSchemes.register(new Scheme("http", sf, 80));
       
        ThreadSafeClientConnManager mgr = new ThreadSafeClientConnManager(
                params, supportedSchemes);

        DefaultHttpClient client = new DefaultHttpClient(mgr, params);
View Full Code Here

Examples of org.apache.http.conn.scheme.SchemeRegistry

        public HttpParams getParams() {
            throw new UnsupportedOperationException("just a mockup");
        }

        public SchemeRegistry getSchemeRegistry() {
            SchemeRegistry registry = new SchemeRegistry();
            registry.register(new Scheme("http", new SocketFactoryMockup(null), 80));
            return registry;
        }
View Full Code Here

Examples of org.apache.http.conn.scheme.SchemeRegistry

        HttpConnectionParams.setStaleCheckingEnabled(params, false);
        ConnManagerParams.setMaxTotalConnections(params, 1);
        ConnManagerParams.setMaxConnectionsPerRoute(params,
                new ConnPerRouteBean(1));
       
        SchemeRegistry supportedSchemes = new SchemeRegistry();
        SocketFactory sf = PlainSocketFactory.getSocketFactory();
        supportedSchemes.register(new Scheme("http", sf, 80));
       
        ThreadSafeClientConnManager mgr = new ThreadSafeClientConnManager(
                params, supportedSchemes);

        DefaultHttpClient client = new DefaultHttpClient(mgr, params);
View Full Code Here

Examples of org.apache.http.conn.scheme.SchemeRegistry

            // expected
        }
    }

    public void testRegisterUnregister() {
        SchemeRegistry schmreg = new SchemeRegistry();

        Scheme http = new Scheme
            ("http", PlainSocketFactory.getSocketFactory(), 80);
        Scheme https = new Scheme
            ("https", SecureSocketFactoryMockup.INSTANCE, 443);
        //  ("https", SSLSocketFactory.getSocketFactory(), 443);
        Scheme myhttp = new Scheme
            ("http", PlainSocketFactory.getSocketFactory(), 80);

        HttpHost host  = new HttpHost("www.test.invalid", -1, "http");
        HttpHost hosts = new HttpHost("www.test.invalid", -1, "https");

        assertNull(schmreg.register(myhttp));
        assertNull(schmreg.register(https));
        assertSame(myhttp, schmreg.register(http));
        assertSame(http, schmreg.getScheme("http"));
        assertSame(http, schmreg.getScheme(host));
        assertSame(https, schmreg.getScheme("https"));
        assertSame(https, schmreg.getScheme(hosts));

        schmreg.unregister("http");
        schmreg.unregister("https");

        assertNull(schmreg.get("http")); // get() does not throw exception
        try {
            schmreg.getScheme("http"); // getScheme() does throw exception
            fail("IllegalStateException should have been thrown");
        } catch (IllegalStateException ex) {
            // 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.