Package org.openqa.selenium

Examples of org.openqa.selenium.Proxy


    }

    @Test
    public void shouldCreateConfigUrlProxy() throws MalformedURLException {
        String pacUrl = "http://example.com/proxy.pac";
        Proxy proxy = factory.getConfigUrlProxy(pacUrl);

        assertThat(proxy.getProxyType(), is(Proxy.ProxyType.PAC));
        assertThat(proxy.getProxyAutoconfigUrl(), is(pacUrl));
    }
View Full Code Here


        ProxyHostPort http = new ProxyHostPort("http.com", 1234);
        ProxyHostPort https = new ProxyHostPort("https.com", 1234);
        ProxyHostPort ftp = new ProxyHostPort("ftp", 1234);
        ProxyHostPort socks = new ProxyHostPort("socks", 1234);
        String noProxy = "none";
        Proxy proxy = factory.getManualProxy(http, https, ftp, socks, noProxy);

        assertThat(proxy.getProxyType(), is(Proxy.ProxyType.MANUAL));
        assertThat(proxy.getHttpProxy(), is(http.toUnifiedForm()));
        assertThat(proxy.getSslProxy(), is(https.toUnifiedForm()));
        assertThat(proxy.getFtpProxy(), is(ftp.toUnifiedForm()));
        assertThat(proxy.getSocksProxy(), is(socks.toUnifiedForm()));
        assertThat(proxy.getNoProxy(), is(noProxy));
    }
View Full Code Here

        assertThat(proxy.getNoProxy(), is(noProxy));
    }

    @Test
    public void shouldCreateSystemProxy() {
        Proxy proxy = factory.getSystemProxy();

        assertThat(proxy.getProxyType(), is(Proxy.ProxyType.SYSTEM));
    }
View Full Code Here

        assertThat(config.getProxyType(), is(type));
    }

    @Test
    public void shouldDelegateToProxyFactoryWhenCreatingSystemProxy() {
        when(proxyFactory.getSystemProxy()).thenReturn(new Proxy());
        config.setProxyType(ProxyType.SYSTEM);

        Proxy proxy = config.createProxy();

        assertThat(proxy, is(notNullValue()));
        verify(proxyFactory, times(1)).getSystemProxy();
    }
View Full Code Here

        verify(proxyFactory, times(1)).getSystemProxy();
    }

    @Test
    public void shouldDelegateToProxyFactoryWhenCreatingDirectProxy() {
        when(proxyFactory.getDirectProxy()).thenReturn(new Proxy());
        config.setProxyType(ProxyType.DIRECT);

        Proxy proxy = config.createProxy();

        assertThat(proxy, is(notNullValue()));
        verify(proxyFactory, times(1)).getDirectProxy();
    }
View Full Code Here

        verify(proxyFactory, times(1)).getDirectProxy();
    }

    @Test
    public void shouldDelegateToProxyFactoryWhenCreatingAutoDetectProxy() {
        when(proxyFactory.getAutodetectProxy()).thenReturn(new Proxy());
        config.setProxyType(ProxyType.AUTO_DETECT);

        Proxy proxy = config.createProxy();

        assertThat(proxy, is(notNullValue()));
        verify(proxyFactory, times(1)).getAutodetectProxy();
    }
View Full Code Here

        config.setFtpHost(ftp.getHost());
        config.setFtpPort(ftp.getPort());
        config.setSocksHost(socks.getHost());
        config.setSocksPort(socks.getPort());
        config.setNoProxyHost(noProxy);
        when(proxyFactory.getManualProxy(http, https, ftp, socks, noProxy)).thenReturn(new Proxy());
        config.setProxyType(ProxyType.MANUAL);

        Proxy proxy = config.createProxy();

        assertThat(proxy, is(notNullValue()));
        verify(proxyFactory, times(1)).getManualProxy(http, https, ftp, socks, noProxy);
    }
View Full Code Here

        final String noProxy = "host1, host2";
        config.setHttpHost(http.getHost());
        config.setHttpPort(http.getPort());
        config.setUseHttpSettingsForAllProtocols(true);
        config.setNoProxyHost(noProxy);
        when(proxyFactory.getManualProxy(http, http, http, http, noProxy)).thenReturn(new Proxy());
        config.setProxyType(ProxyType.MANUAL);

        Proxy proxy = config.createProxy();

        assertThat(proxy, is(notNullValue()));
        verify(proxyFactory, times(1)).getManualProxy(http, http, http, http, noProxy);
    }
View Full Code Here

    }

    @Test
    public void shouldDelegateToProxyFactoryWhenCreatingProxyPacProxy() throws MalformedURLException {
        String url = "http://proxy/pac.url";
        when(proxyFactory.getConfigUrlProxy(url)).thenReturn(new Proxy());
        config.setProxyPacUrl(url);
        config.setProxyType(ProxyType.PROXY_PAC);

        Proxy proxy = config.createProxy();

        assertThat(proxy, is(notNullValue()));
        verify(proxyFactory, times(1)).getConfigUrlProxy(Mockito.isA(String.class));
    }
View Full Code Here

    }
  }

  @Test
  public void parseManualProxies() {
    Proxy p = new Proxy()
        .setHttpProxy(host)
        .setFtpProxy(host)
        .setAutodetect(false);

    proxy.parse(p);
View Full Code Here

TOP

Related Classes of org.openqa.selenium.Proxy

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.