Example usage for org.apache.http.nio.conn.ssl SSLLayeringStrategy SSLLayeringStrategy

List of usage examples for org.apache.http.nio.conn.ssl SSLLayeringStrategy SSLLayeringStrategy

Introduction

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

Prototype

public SSLLayeringStrategy(final SSLContext sslContext) 

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 w  w .  j  av  a2  s .  c  o m*/
        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//from w  w  w  .j  a  v  a 2s .  com
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);
    }
}