Search in sources :

Example 1 with HttpClient

use of org.webpieces.httpclient.api.HttpClient in project webpieces by deanhiller.

the class IntegGoogleHttps method createSocket.

public static HttpSocket createSocket(boolean isHttp, String host, int port) {
    HttpClient client = createHttpClient();
    HttpSocket socket;
    if (isHttp)
        socket = client.createHttpSocket("oneTimer");
    else {
        ForTestSslClientEngineFactory sslFactory = new ForTestSslClientEngineFactory();
        socket = client.createHttpsSocket("oneTimer", sslFactory.createSslEngine(host, port));
    }
    return socket;
}
Also used : HttpSocket(org.webpieces.httpclient.api.HttpSocket) HttpClient(org.webpieces.httpclient.api.HttpClient)

Example 2 with HttpClient

use of org.webpieces.httpclient.api.HttpClient in project webpieces by deanhiller.

the class IntegGoogleHttps method createHttpClient.

public static HttpClient createHttpClient() {
    BufferPool pool2 = new BufferCreationPool();
    Executor executor2 = Executors.newFixedThreadPool(10, new NamedThreadFactory("clientThread"));
    ChannelManagerFactory factory = ChannelManagerFactory.createFactory();
    ChannelManager mgr = factory.createMultiThreadedChanMgr("client", pool2, executor2);
    HttpParser parser = HttpParserFactory.createParser(pool2);
    HttpClient client = HttpClientFactory.createHttpClient(mgr, parser);
    return client;
}
Also used : BufferPool(org.webpieces.data.api.BufferPool) Executor(java.util.concurrent.Executor) ChannelManager(org.webpieces.nio.api.ChannelManager) NamedThreadFactory(org.webpieces.util.threading.NamedThreadFactory) HttpClient(org.webpieces.httpclient.api.HttpClient) HttpParser(org.webpieces.httpparser.api.HttpParser) BufferCreationPool(org.webpieces.data.api.BufferCreationPool) ChannelManagerFactory(org.webpieces.nio.api.ChannelManagerFactory)

Aggregations

HttpClient (org.webpieces.httpclient.api.HttpClient)2 Executor (java.util.concurrent.Executor)1 BufferCreationPool (org.webpieces.data.api.BufferCreationPool)1 BufferPool (org.webpieces.data.api.BufferPool)1 HttpSocket (org.webpieces.httpclient.api.HttpSocket)1 HttpParser (org.webpieces.httpparser.api.HttpParser)1 ChannelManager (org.webpieces.nio.api.ChannelManager)1 ChannelManagerFactory (org.webpieces.nio.api.ChannelManagerFactory)1 NamedThreadFactory (org.webpieces.util.threading.NamedThreadFactory)1