Examples of SchemeRegistry


Examples of org.apache.http.conn.scheme.SchemeRegistry

  final Logger logger = LoggerFactory.getLogger(this.getClass());
  private PoolingClientConnectionManager connectionManager;
  private HttpClient client;
 
  PoolingHttpClient(){
    SchemeRegistry schemeRegistry = new SchemeRegistry();
    schemeRegistry.register(
             new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
    schemeRegistry.register(
             new Scheme("https", 443, SSLSocketFactory.getSocketFactory()));
    connectionManager = new PoolingClientConnectionManager(schemeRegistry);
    /*
     *
     *
 
View Full Code Here

Examples of org.apache.http.conn.scheme.SchemeRegistry

      logger.error("KeyManagementException :" + e1.getMessage());
      e1.printStackTrace();
    }
    SchemeSocketFactory sf = (SchemeSocketFactory) new SSLSocketFactory(sc, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
   
    SchemeRegistry schemeRegistry = new SchemeRegistry();
    schemeRegistry.register(
             new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
    schemeRegistry.register(
        new Scheme("https", 443, sf));
    connectionManager = new PoolingClientConnectionManager(schemeRegistry);
    // Increase max total connection to 200
    //cm.setMaxTotal(200);
    // Increase default max connection per route to 20
View Full Code Here

Examples of org.apache.http.conn.scheme.SchemeRegistry

      SSLSocketFactory sf = new SSLSocketFactory(sslContext, new AllowAllHostnameVerifier());
      httpsScheme = new Scheme("https", 443, sf);
    }
    else
      httpsScheme = new Scheme("http", 80, PlainSocketFactory.getSocketFactory());
    SchemeRegistry schemeRegistry = new SchemeRegistry();
    schemeRegistry.register(httpsScheme);
    HttpParams params = getHttpParams(connectionTimeout, soTimeout);
    ClientConnectionManager cm = new ThreadSafeClientConnManager(schemeRegistry);
    return new DefaultHttpClient(cm, params);
  }
View Full Code Here

Examples of org.apache.http.conn.scheme.SchemeRegistry

      SSLSocketFactory sf = new SSLSocketFactory(sslContext, new AllowAllHostnameVerifier());
      httpsScheme = new Scheme("https", 443, sf);
    }
    else
      httpsScheme = new Scheme("http", 80, PlainSocketFactory.getSocketFactory());
    SchemeRegistry schemeRegistry = new SchemeRegistry();
    schemeRegistry.register(httpsScheme);
    HttpParams params = getHttpParams(connectionTimeout, soTimeout);
    ClientConnectionManager cm = new ThreadSafeClientConnManager(schemeRegistry);
    return new DefaultHttpClient(cm, params);
  }
View Full Code Here

Examples of org.apache.http.conn.scheme.SchemeRegistry

      SSLSocketFactory sf = new SSLSocketFactory(sslContext, new AllowAllHostnameVerifier());
      httpsScheme = new Scheme("https", 443, sf);
    }
    else
      httpsScheme = new Scheme("http", 80, PlainSocketFactory.getSocketFactory());
    SchemeRegistry schemeRegistry = new SchemeRegistry();
    schemeRegistry.register(httpsScheme);
    HttpParams params = getHttpParams(connectionTimeout, soTimeout);
    ClientConnectionManager cm = new ThreadSafeClientConnManager(schemeRegistry);
    return new DefaultHttpClient(cm, params);
  }
View Full Code Here

Examples of org.apache.http.conn.scheme.SchemeRegistry

      SSLSocketFactory sf = new SSLSocketFactory(sslContext, new AllowAllHostnameVerifier());
      httpsScheme = new Scheme("https", 443, sf);
    }
    else
      httpsScheme = new Scheme("http", 80, PlainSocketFactory.getSocketFactory());
    SchemeRegistry schemeRegistry = new SchemeRegistry();
    schemeRegistry.register(httpsScheme);
    HttpParams params = getHttpParams(connectionTimeout, soTimeout);
    ClientConnectionManager cm = new ThreadSafeClientConnManager(schemeRegistry);
    return new DefaultHttpClient(cm, params);
  }
View Full Code Here

Examples of org.apache.http.conn.scheme.SchemeRegistry

        final IBoxRESTClient restClient = new BoxRESTClient(connectionManager.build()) {
            @Override
            public HttpClient getRawHttpClient() {
                final HttpClient httpClient = super.getRawHttpClient();
                clientConnectionManager[0] = httpClient.getConnectionManager();
                final SchemeRegistry schemeRegistry = clientConnectionManager[0].getSchemeRegistry();
                SSLContextParameters sslContextParameters = configuration.getSslContextParameters();
                if (sslContextParameters == null) {
                    sslContextParameters = new SSLContextParameters();
                }
                try {
                    final SSLSocketFactory socketFactory = new SSLSocketFactory(
                        sslContextParameters.createSSLContext(),
                        SSLSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
                    schemeRegistry.register(new Scheme("https", socketFactory, 443));
                } catch (GeneralSecurityException e) {
                    throw ObjectHelper.wrapRuntimeCamelException(e);
                } catch (IOException e) {
                    throw ObjectHelper.wrapRuntimeCamelException(e);
                }
View Full Code Here

Examples of org.apache.http.conn.scheme.SchemeRegistry

  public SparkTestUtil(int port) {
    this.port = port;
    Scheme http = new Scheme("http", port, PlainSocketFactory.getSocketFactory());
    Scheme https = new Scheme("https", port, new org.apache.http.conn.ssl.SSLSocketFactory(getSslFactory(), null));
    SchemeRegistry sr = new SchemeRegistry();
    sr.register(http);
    sr.register(https);
    ClientConnectionManager connMrg = new BasicClientConnectionManager(sr);
    this.httpClient = new DefaultHttpClient(connMrg);
  }
View Full Code Here

Examples of org.apache.http.conn.scheme.SchemeRegistry

        schemeSocketFactory = new SSLSocketFactory(sslSocketFactory, apacheHostnameVerifier);
      } catch (GeneralSecurityException e) {
        throw new IllegalArgumentException("Error building SSL client", e);
      }

      SchemeRegistry schemeRegistry = new SchemeRegistry();
      schemeRegistry.register(new Scheme("https", 443, schemeSocketFactory));

      connectionManager = buildConnectionManager(schemeRegistry);
    } else {
      SchemeRegistry schemeRegistry = SchemeRegistryFactory.createDefault();
      connectionManager = buildConnectionManager(schemeRegistry);
    }

    HttpClient httpClient = buildDefaultHttpClient(connectionManager, httpParams);
View Full Code Here

Examples of org.apache.http.conn.scheme.SchemeRegistry

            // TODO KKr - set on connection manager params, or client params?
            CookieSpecParamBean cookieParams = new CookieSpecParamBean(params);
            cookieParams.setSingleHeader(true);

            // Create and initialize scheme registry
            SchemeRegistry schemeRegistry = new SchemeRegistry();
            schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
            SSLSocketFactory sf = null;

            for (String contextName : SSL_CONTEXT_NAMES) {
                try {
                    SSLContext sslContext = SSLContext.getInstance(contextName);
                    sslContext.init(null, new TrustManager[] { new DummyX509TrustManager(null) }, null);
                    sf = new SSLSocketFactory(sslContext);
                    break;
                } catch (NoSuchAlgorithmException e) {
                    LOGGER.debug("SSLContext algorithm not available: " + contextName);
                } catch (Exception e) {
                    LOGGER.debug("SSLContext can't be initialized: " + contextName, e);
                }
            }
           
            if (sf != null) {
                sf.setHostnameVerifier(new DummyX509HostnameVerifier());
                schemeRegistry.register(new Scheme("https", sf, 443));
            } else {
                LOGGER.warn("No valid SSLContext found for https");
            }

            // Use ThreadSafeClientConnManager since more than one thread will be using the HttpClient.
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.