Examples of Scheme


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

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

    public static Test suite() {
        return new TestSuite(TestScheme.class);
    }

    public void testConstructor() {
        Scheme http = new Scheme
            ("http", PlainSocketFactory.getSocketFactory(), 80);
        assertEquals("http", http.getName());
        assertEquals(80, http.getDefaultPort());
        assertSame(PlainSocketFactory.getSocketFactory(),
                   http.getSocketFactory());
        assertFalse(http.isLayered());
        Scheme https = new Scheme
            ("https", SecureSocketFactoryMockup.INSTANCE, 443);
        //  ("https", SSLSocketFactory.getSocketFactory(), 443);
        assertEquals("https", https.getName());
        assertEquals(443, https.getDefaultPort());
        assertSame(//SSLSocketFactory.getSocketFactory()
                   SecureSocketFactoryMockup.INSTANCE,
                   https.getSocketFactory());
        assertTrue(https.isLayered());

        Scheme hTtP = new Scheme
            ("hTtP", PlainSocketFactory.getSocketFactory(), 80);
        assertEquals("http", hTtP.getName());
        // the rest is no different from above

        try {
            new Scheme(null, PlainSocketFactory.getSocketFactory(), 80);
            fail("IllegalArgumentException should have been thrown");
        } catch (IllegalArgumentException ex) {
            // expected
        }
        try {
            new Scheme("http", null, 80);
            fail("IllegalArgumentException should have been thrown");
        } catch (IllegalArgumentException ex) {
            // expected
        }
        try {
            new Scheme("http", PlainSocketFactory.getSocketFactory(), -1);
            fail("IllegalArgumentException should have been thrown");
        } catch (IllegalArgumentException ex) {
            // expected
        }
        try {
            new Scheme("http", PlainSocketFactory.getSocketFactory(), 70000);
            fail("IllegalArgumentException should have been thrown");
        } catch (IllegalArgumentException ex) {
            // expected
        }
    }
View Full Code Here

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

    }

    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");
View Full Code Here

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

        List<String> names = schmreg.getSchemeNames();
        assertNotNull(names);
        assertTrue(names.isEmpty());

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

        schmreg.register(http);
        schmreg.register(https);
View Full Code Here

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

            // expected
        }
    }
   
    public void testResolvePort() {
        Scheme http = new Scheme
            ("http", PlainSocketFactory.getSocketFactory(), 80);

        assertEquals(8080, http.resolvePort(8080));
        assertEquals(80, http.resolvePort(-1));
    }
View Full Code Here

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

        assertEquals(8080, http.resolvePort(8080));
        assertEquals(80, http.resolvePort(-1));
    }
   
    public void testHashCode() {
        Scheme http = new Scheme
            ("http", PlainSocketFactory.getSocketFactory(), 80);
        Scheme myhttp = new Scheme
            ("http", PlainSocketFactory.getSocketFactory(), 80);
        Scheme https = new Scheme
            ("https", SecureSocketFactoryMockup.INSTANCE, 443);
        //  ("https", SSLSocketFactory.getSocketFactory(), 443);

        assertTrue(http.hashCode() != https.hashCode()); // not guaranteed
        assertTrue(http.hashCode() == myhttp.hashCode());
    }
View Full Code Here

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

        assertTrue(http.hashCode() != https.hashCode()); // not guaranteed
        assertTrue(http.hashCode() == myhttp.hashCode());
    }
   
    public void testEquals() {
        Scheme http = new Scheme
            ("http", PlainSocketFactory.getSocketFactory(), 80);
        Scheme myhttp = new Scheme
            ("http", PlainSocketFactory.getSocketFactory(), 80);
        Scheme https = new Scheme
            ("https", SecureSocketFactoryMockup.INSTANCE, 443);
        //  ("https", SSLSocketFactory.getSocketFactory(), 443);

        assertFalse(http.equals(https));
        assertFalse(http.equals(null));
View Full Code Here

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

        assertTrue(http.equals(myhttp));
        assertFalse(http.equals(https));
    }

    public void testToString() {
        Scheme http = new Scheme
            ("http", PlainSocketFactory.getSocketFactory(), 80);
        // test it twice, the result is cached
        assertEquals("http:80", http.toString());
        assertEquals("http:80", http.toString());
    }
View Full Code Here

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

    public void testAbortAfterAllocateBeforeRequest() throws Exception {
        this.localServer.register("*", new BasicService());
       
        CountDownLatch releaseLatch = new CountDownLatch(1);
        SchemeRegistry registry = new SchemeRegistry();
        registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
       
        SingleClientConnManager conMan = new SingleClientConnManager(new BasicHttpParams(), registry);
        final AtomicReference<Throwable> throwableRef = new AtomicReference<Throwable>();
        final CountDownLatch getLatch = new CountDownLatch(1);
        final DefaultHttpClient client = new DefaultHttpClient(conMan, new BasicHttpParams());
View Full Code Here

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

     */
    public void testAbortBeforeExecute() throws Exception {
        this.localServer.register("*", new BasicService());
       
        SchemeRegistry registry = new SchemeRegistry();
        registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
       
        SingleClientConnManager conMan = new SingleClientConnManager(new BasicHttpParams(), registry);
        final AtomicReference<Throwable> throwableRef = new AtomicReference<Throwable>();
        final CountDownLatch getLatch = new CountDownLatch(1);
        final CountDownLatch startLatch = new CountDownLatch(1);
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.