Example usage for org.apache.http.nio.conn.scheme AsyncScheme AsyncScheme

List of usage examples for org.apache.http.nio.conn.scheme AsyncScheme AsyncScheme

Introduction

In this page you can find the example usage for org.apache.http.nio.conn.scheme AsyncScheme AsyncScheme.

Prototype

public AsyncScheme(final String name, final int port, final LayeringStrategy strategy) 

Source Link

Usage

From source file:com.example.jira.remote.atlassian.AsynchronousHttpClientFactory.java

public AsyncSchemeRegistry createAsyncSchemeRegistry() {
    AsyncSchemeRegistry registry = new AsyncSchemeRegistry();
    registry.register(new AsyncScheme("http", 80, null));
    registry.register(new AsyncScheme("https", 443, new SSLLayeringStrategy(sslContext)));
    return registry;
}

From source file:iqq.im.service.ApacheHttpService.java

@Override
public void init(QQContext context) throws QQException {
    super.init(context);
    try {//from w ww.  j a  v a 2 s . c om
        SSLContext sslContext = new QQSSLSocketFactory().getSSLContext();
        SSLContext.setDefault(sslContext);
        asyncHttpClient = new DefaultHttpAsyncClient();

        HttpParams httpParams = asyncHttpClient.getParams();
        HttpConnectionParams.setSoTimeout(httpParams, QQConstants.HTTP_TIME_OUT);
        HttpConnectionParams.setConnectionTimeout(httpParams, QQConstants.HTTP_TIME_OUT);
        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);
    }
}

From source file:com.minws.frame.sdk.webqq.service.ApacheHttpService.java

/** {@inheritDoc} */
@Override/* ww  w .  jav a 2 s  .co  m*/
public void init(QQContext context) throws QQException {
    super.init(context);
    try {
        SSLContext sslContext = new QQSSLSocketFactory().getSSLContext();
        SSLContext.setDefault(sslContext);
        asyncHttpClient = new DefaultHttpAsyncClient();

        HttpParams httpParams = asyncHttpClient.getParams();
        HttpConnectionParams.setSoTimeout(httpParams, QQConstants.HTTP_TIME_OUT);
        HttpConnectionParams.setConnectionTimeout(httpParams, QQConstants.HTTP_TIME_OUT);
        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);
    }
}