Package org.apache.http.nio.conn.scheme

Examples of org.apache.http.nio.conn.scheme.AsyncScheme


    }

    @Override
    public void initClient() throws Exception {
        super.initClient();
        this.connMgr.getSchemeRegistry().register(new AsyncScheme("https", 443,
                new SSLLayeringStrategy(SSLTestContexts.createClientSSLContext())));
    }
View Full Code Here


        HttpHost target = route.getTargetHost();
        HttpHost proxy = route.getProxyHost();
        IOSession iosession = entry.getConnection();

        if (proxy == null) {
            AsyncScheme scheme = getSchemeRegistry(context).getScheme(target);
            LayeringStrategy layeringStrategy = scheme.getLayeringStrategy();
            if (layeringStrategy != null) {
                iosession = layeringStrategy.layer(iosession);
            }
        }
View Full Code Here

        }
        if (tracker.isLayered()) {
            throw new IllegalStateException("Multiple protocol layering not supported");
        }
        HttpHost target = tracker.getTargetHost();
        AsyncScheme scheme = getSchemeRegistry(context).getScheme(target);
        LayeringStrategy layeringStrategy = scheme.getLayeringStrategy();
        if (layeringStrategy == null) {
            throw new IllegalStateException(scheme.getName() +
                    " scheme does not provider support for protocol layering");
        }
        IOSession iosession = entry.getConnection();
        ClientAsyncConnection conn = (ClientAsyncConnection) iosession.getAttribute(
                IOEventDispatch.CONNECTION_KEY);
View Full Code Here

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

        if (target == null) {
            throw new IllegalStateException("Target host may be null");
        }
        InetAddress local = ConnRouteParams.getLocalAddress(request.getParams());
        HttpHost proxy = ConnRouteParams.getDefaultProxy(request.getParams());
        AsyncScheme scheme;
        try {
            AsyncSchemeRegistry registry = getSchemeRegistry(context);
            scheme = registry.getScheme(target);
        } catch (IllegalStateException ex) {
            throw new HttpException(ex.getMessage());
        }
        LayeringStrategy layeringStrategy = scheme.getLayeringStrategy();
        boolean secure = layeringStrategy != null && layeringStrategy.isSecure();
        if (proxy == null) {
            route = new HttpRoute(target, local, secure);
        } else {
            route = new HttpRoute(target, local, proxy, secure);
View Full Code Here

          HttpConnectionParams.setTcpNoDelay(httpParams, true);
          HttpConnectionParams.setSocketBufferSize(httpParams, 4096);
          HttpProtocolParams.setVersion(httpParams, HttpVersion.HTTP_1_1);
     
          asyncHttpClient.getConnectionManager()
          .getSchemeRegistry().register(new AsyncScheme("https", 443, new SSLLayeringStrategy(sslContext)));
      asyncHttpClient.setRedirectStrategy(new QQDefaultRedirectStrategy());
      asyncHttpClient.start();
      cookieJar = new QQHttpCookieJar();
    } catch (IOReactorException e) {
      throw new QQException(QQErrorCode.INIT_ERROR, e);
View Full Code Here

            if (tlsClientParameters != null && tlsClientParameters.hashCode() == lastTlsHash && sslState != null) {
                ctx.setAttribute(ClientContext.USER_TOKEN , sslState);
            }
           
            final AsyncSchemeRegistry reg = new AsyncSchemeRegistry();
            reg.register(new AsyncScheme("http", 80, null));
            if ("https".equals(url.getScheme())) {
                try {
                    final SSLContext sslcontext = getSSLContext();
                    reg.register(new AsyncScheme("https", 443, new SSLLayeringStrategy(sslcontext) {
                        @Override
                        protected void initializeEngine(SSLEngine engine) {
                            initializeSSLEngine(sslcontext, engine);
                        }
                        @Override
View Full Code Here

        });
        // Start the client thread
        t.start();
       
        AsyncSchemeRegistry registry = new AsyncSchemeRegistry();
        registry.register(new AsyncScheme("http", 80, null));
        registry.register(new AsyncScheme("https", 443, null));

        connectionManager = new PoolingClientAsyncConnectionManager(ioReactor, registry,
                                                                    connectionTTL, TimeUnit.MILLISECONDS) {
            @Override
            protected ClientAsyncConnectionFactory createClientAsyncConnectionFactory() {
View Full Code Here

            if (tlsClientParameters != null && tlsClientParameters.hashCode() == lastTlsHash && sslState != null) {
                ctx.setAttribute(ClientContext.USER_TOKEN , sslState);
            }
           
            final AsyncSchemeRegistry reg = new AsyncSchemeRegistry();
            reg.register(new AsyncScheme("http", 80, null));
            if ("https".equals(url.getScheme())) {
                try {
                    // check tlsClientParameters from message header
                    TLSClientParameters tlsClientParameters = outMessage.get(TLSClientParameters.class);
                    if (tlsClientParameters == null) {
                        tlsClientParameters = getTlsClientParameters();
                    }
                    if (tlsClientParameters == null) {
                        tlsClientParameters = new TLSClientParameters();
                    }

                    final SSLContext sslcontext = getSSLContext(tlsClientParameters);
                    reg.register(new AsyncScheme("https", 443, new SSLLayeringStrategy(sslcontext) {
                        @Override
                        protected void initializeEngine(SSLEngine engine) {
                            initializeSSLEngine(sslcontext, engine);
                        }
                        @Override
View Full Code Here

        });
        // Start the client thread
        t.start();
       
        AsyncSchemeRegistry registry = new AsyncSchemeRegistry();
        registry.register(new AsyncScheme("http", 80, null));
        registry.register(new AsyncScheme("https", 443, null));

        connectionManager = new PoolingClientAsyncConnectionManager(ioReactor, registry,
                                                                    connectionTTL, TimeUnit.MILLISECONDS) {
            @Override
            protected ClientAsyncConnectionFactory createClientAsyncConnectionFactory() {
View Full Code Here

TOP

Related Classes of org.apache.http.nio.conn.scheme.AsyncScheme

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.