Examples of Proxy


Examples of java.net.Proxy

    // 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

Examples of java.net.Proxy

    // 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

Examples of java.net.Proxy

        });
        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

Examples of java.net.Proxy

        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

Examples of java.net.Proxy

        return null;
    }

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

Examples of java.net.Proxy

                    @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

Examples of java.net.Proxy

                        @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

Examples of java.net.Proxy

   * @param host
   * @param proxyType
   * @return proxy or null if it cannot be resolved
   */
  public static Proxy getProxy(String host, String proxyType) {
    Proxy foundProxy = null;
    try {

      URI uri = new URI(proxyType, "//" + host, null);
      List<Proxy> proxies = ProxySelector.getDefault().select(uri);

View Full Code Here

Examples of java.net.Proxy

    this.url = url;
    this.requestMethod = method;
  }

  private Proxy createProxy() {
    return new Proxy(HTTP, new InetSocketAddress(httpProxyHost, httpProxyPort));
  }
View Full Code Here

Examples of java.net.Proxy

    public Socket createSocket(final String host, final int port, final InetAddress localAddress, final int localPort, final HttpConnectionParams params)
            throws IOException, UnknownHostException, ConnectTimeoutException {

        InetSocketAddress socksAddr = new InetSocketAddress(socksHost, socksPort);
        Proxy proxy = new Proxy(Proxy.Type.SOCKS, socksAddr);
        int timeout = params.getConnectionTimeout();

        Socket socket = new Socket(proxy);
        socket.setSoTimeout(timeout);
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.