Search in sources :

Example 1 with HttpClient

use of org.webpieces.httpclient11.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(new SocketListener());
    else {
        ForTestSslClientEngineFactory sslFactory = new ForTestSslClientEngineFactory();
        socket = client.createHttpsSocket(sslFactory.createSslEngine(host, port), new SocketListener());
    }
    return socket;
}
Also used : HttpSocket(org.webpieces.httpclient11.api.HttpSocket) HttpClient(org.webpieces.httpclient11.api.HttpClient)

Example 2 with HttpClient

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

the class Http2to11ClientFactory method createHttpClient.

public static Http2Client createHttpClient(String id, ChannelManager mgr, MeterRegistry metrics, BufferPool pool, boolean optimizeForBufferPool) {
    HttpParser parser = HttpParserFactory.createParser(id, metrics, pool, optimizeForBufferPool);
    HttpClient client11 = HttpClientFactory.createHttpClient(id, mgr, parser);
    return new Http2ClientProxy(client11);
}
Also used : HttpClient(org.webpieces.httpclient11.api.HttpClient) HttpParser(org.webpieces.httpparser.api.HttpParser) Http2ClientProxy(org.webpieces.httpclientx.impl.Http2ClientProxy)

Example 3 with HttpClient

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

the class IntegGoogleHttps method createHttpClient.

public static HttpClient createHttpClient() {
    BufferPool pool2 = new TwoPools("pl", new SimpleMeterRegistry());
    Executor executor2 = Executors.newFixedThreadPool(10, new NamedThreadFactory("clientThread"));
    ChannelManagerFactory factory = ChannelManagerFactory.createFactory(Metrics.globalRegistry);
    ChannelManager mgr = factory.createMultiThreadedChanMgr("client", pool2, new BackpressureConfig(), executor2);
    HttpParser parser = HttpParserFactory.createParser("a", new SimpleMeterRegistry(), pool2);
    HttpClient client = HttpClientFactory.createHttpClient("myClient", mgr, parser);
    return client;
}
Also used : BackpressureConfig(org.webpieces.nio.api.BackpressureConfig) BufferPool(org.webpieces.data.api.BufferPool) Executor(java.util.concurrent.Executor) ChannelManager(org.webpieces.nio.api.ChannelManager) TwoPools(org.webpieces.data.api.TwoPools) NamedThreadFactory(org.webpieces.util.threading.NamedThreadFactory) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) HttpClient(org.webpieces.httpclient11.api.HttpClient) HttpParser(org.webpieces.httpparser.api.HttpParser) ChannelManagerFactory(org.webpieces.nio.api.ChannelManagerFactory)

Aggregations

HttpClient (org.webpieces.httpclient11.api.HttpClient)3 HttpParser (org.webpieces.httpparser.api.HttpParser)2 SimpleMeterRegistry (io.micrometer.core.instrument.simple.SimpleMeterRegistry)1 Executor (java.util.concurrent.Executor)1 BufferPool (org.webpieces.data.api.BufferPool)1 TwoPools (org.webpieces.data.api.TwoPools)1 HttpSocket (org.webpieces.httpclient11.api.HttpSocket)1 Http2ClientProxy (org.webpieces.httpclientx.impl.Http2ClientProxy)1 BackpressureConfig (org.webpieces.nio.api.BackpressureConfig)1 ChannelManager (org.webpieces.nio.api.ChannelManager)1 ChannelManagerFactory (org.webpieces.nio.api.ChannelManagerFactory)1 NamedThreadFactory (org.webpieces.util.threading.NamedThreadFactory)1