Package com.volantis.shared.net.impl.proxy

Examples of com.volantis.shared.net.impl.proxy.SystemProxyManager


                HTTPSystemPropertyKeys.HTTP_PROXY_HOST, "").returns(" ");

        systemPropertiesMock.expects.getProperty(
                HTTPSystemPropertyKeys.PROXY_HOST, "").returns(" ");

        SystemProxyManager manager = new SystemProxyManager(
                ProxyFactory.getDefaultInstance(),
                systemPropertiesMock);
        assertNull(manager.getSystemProxy());
    }
View Full Code Here


        systemPropertiesMock.expects.getProperty(
                HTTPSystemPropertyKeys.PROXY_PASSWORD, "").returns("mine");
        systemPropertiesMock.expects.getProperty(
                HTTPSystemPropertyKeys.PROXY_EXCLUDE, "").returns("");

        SystemProxyManager manager = new SystemProxyManager(
                ProxyFactory.getDefaultInstance(),
                systemPropertiesMock);
        Proxy proxy = manager.getSystemProxy();
        checkProxy(proxy, "foobar", 90, "me", "mine");
    }
View Full Code Here

    public void testHostOnly() throws Exception {

        // Ensure that when the host is specified a system proxy is created.
        addHTTPPropertyExpectations("foobar", "", "", "", "");

        SystemProxyManager manager = new SystemProxyManager(
                ProxyFactory.getDefaultInstance(),
                systemPropertiesMock);
        Proxy proxy = manager.getSystemProxy();
        checkProxy(proxy, "foobar", 80, null, null);
    }
View Full Code Here

    public void testAllExceptExcludesList() throws Exception {

        // Ensure that when the host is specified a system proxy is created.
        addHTTPPropertyExpectations("foobar", "99", "me", "mine", "");

        SystemProxyManager manager = new SystemProxyManager(
                ProxyFactory.getDefaultInstance(),
                systemPropertiesMock);
        Proxy proxy;
        proxy = manager.getSystemProxy();
        checkProxy(proxy, "foobar", 99, "me", "mine");
    }
View Full Code Here

        // Ensure that when the host is specified a system proxy is created.
        addHTTPPropertyExpectations("foobar", "99", "me", "mine",
                "*.volantis.com|www.google.com");

        SystemProxyManager manager = new SystemProxyManager(
                ProxyFactory.getDefaultInstance(),
                systemPropertiesMock);
        Proxy systemProxy = manager.getSystemProxy();
        checkProxy(systemProxy, "foobar", 99, "me", "mine");

        assertNull(manager.getProxyForHost("www.volantis.com"));
        assertNull(manager.getProxyForHost("foo.volantis.com"));
        assertNull(manager.getProxyForHost("www.google.com"));
        assertSame(systemProxy, manager.getProxyForHost("www.google.com2"));
    }
View Full Code Here

    private SystemProxyManager createManagerWithExcludeList(
            String excludeList) {

        addHTTPPropertyExpectations("foobar", "99", "me", "mine",
                excludeList);
        return new SystemProxyManager(ProxyFactory.getDefaultInstance(),
                systemPropertiesMock);
    }
View Full Code Here

        return new SystemProxyManager(ProxyFactory.getDefaultInstance(),
                systemPropertiesMock);
    }

    public void testSimpleExclude() throws Exception {
        SystemProxyManager manager;

        manager = createManagerWithExcludeList("localhost");

        assertNotNull("No match", manager.getProxyForHost("not localhost"));
        assertNull("Match", manager.getProxyForHost("localhost"));

        manager = createManagerWithExcludeList("localhost.com");

        assertNotNull("No match", manager.getProxyForHost("not localhost.com"));
        assertNull("Match", manager.getProxyForHost("localhost.com"));
    }
View Full Code Here

     * Ensure wildcard macthing works
     *
     * @throws Exception
     */
    public void testWildcardExclude() throws Exception {
        SystemProxyManager manager;

        manager = createManagerWithExcludeList("*.localhost");

        assertNull("Match", manager.getProxyForHost("a.localhost"));
        assertNull("Match", manager.getProxyForHost("2785.localhost"));
        assertNotNull("No Match (due to training space",
                manager.getProxyForHost("2785.localhost "));

        manager = createManagerWithExcludeList("abc.*.localhost");

        assertNull("Match", manager.getProxyForHost("abc.not.localhost"));
        assertNull("Match", manager.getProxyForHost("abc.*.localhost"));
        assertNull("Match", manager.getProxyForHost("abc..localhost"));
    }
View Full Code Here

     * Ensure OR matching works
     *
     * @throws Exception
     */
    public void testORExclude() throws Exception {
        SystemProxyManager manager;

        manager = createManagerWithExcludeList("www.google.com|localhost");

        assertNull("Match", manager.getProxyForHost("localhost"));
        assertNull("Match", manager.getProxyForHost("www.google.com"));
        assertNotNull("No Match (due to training space",
                manager.getProxyForHost("localhost "));

        manager = createManagerWithExcludeList("abc.*.localhost|*.google.com");

        assertNull("Match", manager.getProxyForHost("abc.not.localhost"));
        assertNull("Match", manager.getProxyForHost("abc.*.localhost"));
        assertNull("Match", manager.getProxyForHost("abc..localhost"));
        assertNull("Match", manager.getProxyForHost("mail.google.com"));
        assertNull("Match", manager.getProxyForHost(".google.com"));
    }
View Full Code Here

TOP

Related Classes of com.volantis.shared.net.impl.proxy.SystemProxyManager

Copyright © 2018 www.massapicom. 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.