Package java.net

Examples of java.net.Proxy.type()


        // check the list for one we can use
        for (int i=0; (result == null) && (i < proxies.size()); i++) {

            Proxy p = proxies.get(i);
            switch (p.type()) {

            case DIRECT:
            case HTTP:
                result = p;
                break;
View Full Code Here


        List<Proxy> proxies = psel.select(targetURI);

        Proxy p = chooseProxy(proxies, target, request, context);

        HttpHost result = null;
        if (p.type() == Proxy.Type.HTTP) {
            // convert the socket address to an HttpHost
            if (!(p.address() instanceof InetSocketAddress)) {
                throw new HttpException
                    ("Unable to handle non-Inet proxy address: "+p.address());
            }
View Full Code Here

        // check the list for one we can use
        for (int i=0; (result == null) && (i < proxies.size()); i++) {

            Proxy p = proxies.get(i);
            switch (p.type()) {

            case DIRECT:
            case HTTP:
                result = p;
                break;
View Full Code Here

    factoryBean.setPort(port);
    factoryBean.afterPropertiesSet();

    Proxy result = factoryBean.getObject();

    assertEquals(type, result.type());
    InetSocketAddress address = (InetSocketAddress) result.address();
    assertEquals(hostname, address.getHostName());
    assertEquals(port, address.getPort());
  }
View Full Code Here

            globalProxy = globalProxies.get(0);
        }

        if (expectedProxyHost == null) {
            if (proxySelector != null) {
                assertThat(globalProxy.type(), is(Proxy.Type.DIRECT));
            }
        } else {
            assertThat(proxySelector, is(not(nullValue())));
            assertThat(globalProxy.type(), is(Proxy.Type.HTTP));
            assertThat(expectedProxyHost, is(((InetSocketAddress) globalProxy.address()).getHostName()));
View Full Code Here

            if (proxySelector != null) {
                assertThat(globalProxy.type(), is(Proxy.Type.DIRECT));
            }
        } else {
            assertThat(proxySelector, is(not(nullValue())));
            assertThat(globalProxy.type(), is(Proxy.Type.HTTP));
            assertThat(expectedProxyHost, is(((InetSocketAddress) globalProxy.address()).getHostName()));
        }
    }
}
View Full Code Here

       
        Proxy proxy = UserOptionsManager.getProxy();
        if (proxy == null) {
            optionsPanel.proxyTypeRadioGroup.setSelected(optionsPanel.systemProxyRadio.getModel(), true);
        } else{
            switch (proxy.type()) {
                case DIRECT:
                    optionsPanel.proxyTypeRadioGroup.setSelected(optionsPanel.noProxyRadio.getModel(), true);
                    break;
                case HTTP:
                    optionsPanel.proxyTypeRadioGroup.setSelected(optionsPanel.httpProxyRadio.getModel(), true);
View Full Code Here

        RequestConfig.Builder b = RequestConfig.custom()
            .setSocketTimeout((int) csPolicy.getReceiveTimeout())
            .setConnectTimeout((int) csPolicy.getConnectionTimeout());
        Proxy p = proxyFactory.createProxy(csPolicy , uri);
        if (p != null && p.type() != Proxy.Type.DIRECT) {
            InetSocketAddress isa = (InetSocketAddress)p.address();
            HttpHost proxy = new HttpHost(isa.getHostName(), isa.getPort());
            b.setProxy(proxy);
        }
        e.setConfig(b.build());
View Full Code Here

        List<Proxy> proxies = psel.select(targetURI);

        Proxy p = chooseProxy(proxies, target, request, context);

        HttpHost result = null;
        if (p.type() == Proxy.Type.HTTP) {
            // convert the socket address to an HttpHost
            if (!(p.address() instanceof InetSocketAddress)) {
                throw new HttpException
                    ("Unable to handle non-Inet proxy address: "+p.address());
            }
View Full Code Here

        // check the list for one we can use
        for (int i=0; (result == null) && (i < proxies.size()); i++) {

            Proxy p = proxies.get(i);
            switch (p.type()) {

            case DIRECT:
            case HTTP:
                result = p;
                break;
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.