Examples of Scheme


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

    public void testAbortAfterRedirectedRoute() throws Exception {
        final int port = this.localServer.getServicePort();
        this.localServer.register("*", new BasicRedirectService(port));
       
        SchemeRegistry registry = new SchemeRegistry();
        registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
       
        CountDownLatch connLatch = new CountDownLatch(1);
        CountDownLatch awaitLatch = new CountDownLatch(1);
        ConnMan4 conMan = new ConnMan4(new BasicHttpParams(), registry, connLatch, awaitLatch);
        final AtomicReference<Throwable> throwableRef = new AtomicReference<Throwable>();
View Full Code Here

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

   
    public void testRequestFailureReleasesConnection() throws Exception {
        this.localServer.register("*", new ThrowingService());

        SchemeRegistry registry = new SchemeRegistry();
        registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
       
        ConnMan3 conMan = new ConnMan3(new BasicHttpParams(), registry);
        DefaultHttpClient client = new DefaultHttpClient(conMan, new BasicHttpParams());
        HttpGet httpget = new HttpGet("/a");

View Full Code Here

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

    @Override
    protected ClientConnectionManager createClientConnectionManager() {
        SchemeRegistry registry = new SchemeRegistry();
        registry.register(
                new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
        registry.register(
                new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));

        ClientConnectionManager connManager = null;    
        HttpParams params = getParams();
       
        ClientConnectionManagerFactory factory = null;
View Full Code Here

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

        HttpHost target = route.getTargetHost();
       
        String host = target.getHostName();
        int port = target.getPort();
        if (port < 0) {
            Scheme scheme = connManager.getSchemeRegistry().
                getScheme(target.getSchemeName());
            port = scheme.getDefaultPort();
        }
       
        StringBuilder buffer = new StringBuilder(host.length() + 6);
        buffer.append(host);
        buffer.append(':');
View Full Code Here

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

        }
       
        String hostname = host.getHostName();
        int port = host.getPort();
        if (port < 0) {
            Scheme scheme = connManager.getSchemeRegistry().getScheme(host);
            port = scheme.getDefaultPort();
        }
       
        AuthScheme authScheme = authState.getAuthScheme();
        AuthScope authScope = new AuthScope(
                hostname,
View Full Code Here

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

        ConnManagerParams.setMaxConnectionsPerRoute(params, new ConnPerRouteBean(1));
        ConnManagerParams.setMaxTotalConnections(params, 1);

        SchemeRegistry schreg = new SchemeRegistry();
        SocketFactory sf = PlainSocketFactory.getSocketFactory();
        schreg.register(new Scheme("http", sf, 80));

        XTSCCM mgr = new XTSCCM(params, schreg);

        try {
            // take out the only connection
View Full Code Here

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

    @Override
    protected void setUp() {
        supportedSchemes = new SchemeRegistry();
        SocketFactory sf = PlainSocketFactory.getSocketFactory();
        supportedSchemes.register(new Scheme("http", sf, 80));
    }
View Full Code Here

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

  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.Scheme

    }
    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
    //cm.setDefaultMaxPerRoute(20);
View Full Code Here

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

    return url.substring(0, url.indexOf("/card/search/") + 19);
  }

  private static HttpClient getHttpClient(String url, Integer connectionTimeout, Integer soTimeout) throws NoSuchAlgorithmException, KeyManagementException
  {
    Scheme httpsScheme = null;
    if (url.startsWith("https"))
    {
      SSLContext sslContext = SSLContext.getInstance("SSL");
      sslContext.init(null, new TrustManager[] { new X509TrustManager() {
              public X509Certificate[] getAcceptedIssuers()
              {
                return null;
              }
        public void checkClientTrusted(X509Certificate[] chain,  String authType) throws CertificateException
        {
        }
        public void checkServerTrusted(X509Certificate[] chain,  String authType) throws CertificateException
        {
        }
      }}, new SecureRandom());
      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
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.