Package java.net

Examples of java.net.Proxy


            if (value != null) {
                url = new URL(value);
            }

            if (policy.isSetProxyServer()) {
                Proxy proxy = new Proxy(Proxy.Type.valueOf(policy.getProxyServerType().toString()),
                                        new InetSocketAddress(policy.getProxyServer(),
                                                              policy.getProxyServerPort()));
                connection = url.openConnection(proxy);
            } else {
                connection = url.openConnection();
View Full Code Here


    * @param proxyPort The proxy port number.
    * @throws IllegalArgumentException if the proxyHost parameter is null or if
    *     the proxyPort parameter is outside the range of valid port values.
    */
   public void setProxy(String proxyHost, int proxyPort) {
      Proxy tmpProxy = new Proxy(Proxy.Type.HTTP,new InetSocketAddress(proxyHost,proxyPort));
      setProxy(tmpProxy);
   }
View Full Code Here

    // See SANTUARIO-319
    @Test
    public void test_signature_dsa_detached() throws Exception {

        Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();

        try {
            ResolverHttp.setProxy(proxy);

            ResolverDirectHTTP resolverDirectHTTP = new ResolverDirectHTTP();
            resolverDirectHTTP.engineSetProperty("http.proxy.host", ((InetSocketAddress) proxy.address()).getAddress().getHostAddress());
            resolverDirectHTTP.engineSetProperty("http.proxy.port", "" + ((InetSocketAddress) proxy.address()).getPort());

            TestUtils.switchAllowNotSameDocumentReferences(true);

            // Read in plaintext document
            InputStream sourceDocument =
View Full Code Here

    // See SANTUARIO-319
    @Test
    public void test_signature_hmac_sha1_exclusive_c14n_comments_detached() throws Exception {

        Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();

        try {
            ResolverHttp.setProxy(proxy);

            ResolverDirectHTTP resolverDirectHTTP = new ResolverDirectHTTP();
            resolverDirectHTTP.engineSetProperty("http.proxy.host", ((InetSocketAddress) proxy.address()).getAddress().getHostAddress());
            resolverDirectHTTP.engineSetProperty("http.proxy.port", "" + ((InetSocketAddress) proxy.address()).getPort());

            TestUtils.switchAllowNotSameDocumentReferences(true);

            // Read in plaintext document
            InputStream sourceDocument =
View Full Code Here

    // See SANTUARIO-319
    @Test
    public void test_signature_rsa_detached() throws Exception {

        Proxy proxy = HttpRequestRedirectorProxy.startHttpEngine();

        try {
            ResolverHttp.setProxy(proxy);

            ResolverDirectHTTP resolverDirectHTTP = new ResolverDirectHTTP();
            resolverDirectHTTP.engineSetProperty("http.proxy.host", ((InetSocketAddress) proxy.address()).getAddress().getHostAddress());
            resolverDirectHTTP.engineSetProperty("http.proxy.port", "" + ((InetSocketAddress) proxy.address()).getPort());

            TestUtils.switchAllowNotSameDocumentReferences(true);

            // Read in plaintext document
            InputStream sourceDocument =
View Full Code Here

        });
        InetSocketAddress isa1 = new InetSocketAddress(ia, 11111);
        InetSocketAddress isa2 = new InetSocketAddress(ia, 22222);

        List<Proxy> proxies = new ArrayList<Proxy>(2);
        proxies.add(new Proxy(Proxy.Type.HTTP, isa1));
        proxies.add(new Proxy(Proxy.Type.HTTP, isa2));

        HttpRoutePlanner hrp =
            new ProxySelectorRoutePlanner(createSchemeRegistry(),
                                          new ProxySelectorMockup(proxies));
View Full Code Here

        final HttpURLConnection conn;
        final String proxyHost = getProxyHost();
        final int proxyPort = getProxyPortInt();
        if (proxyHost.length() > 0 && proxyPort > 0){
            Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort));
            //TODO - how to define proxy authentication for a single connection?
            // It's not clear if this is possible
//            String user = getProxyUser();
//            if (user.length() > 0){
//                Authenticator auth = new ProxyAuthenticator(user, getProxyPass());
View Full Code Here

        return null;
    }

    private Proxy getProxy( ProxyInfo proxyInfo )
    {
        return new Proxy( getProxyType( proxyInfo ), getSocketAddress( proxyInfo ) );
    }
View Full Code Here

                    @Override
                    protected HttpURLConnection openConnection(URL url) throws IOException {
                        if (proxyHost != null && proxyPort != null) {
                            InetSocketAddress proxyLocation = new InetSocketAddress(proxyHost, proxyPort);
                            Proxy proxy = new Proxy(Proxy.Type.HTTP, proxyLocation);
                            return (HttpURLConnection) url.openConnection(proxy);
                        } else {
                            return (HttpURLConnection) url.openConnection();
                        }
                    }
View Full Code Here

                        @Override
                        protected HttpURLConnection openConnection(URL url) throws IOException {
                            if (proxyHost != null && proxyPort != null) {
                                InetSocketAddress proxyLocation = new InetSocketAddress(proxyHost, proxyPort);
                                Proxy proxy = new Proxy(Proxy.Type.HTTP, proxyLocation);
                                return (HttpURLConnection) url.openConnection(proxy);
                            } else {
                                return (HttpURLConnection) url.openConnection();
                            }
                        }
View Full Code Here

TOP

Related Classes of java.net.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.