use of org.webpieces.http2client.SocketListener in project webpieces by deanhiller.
the class IntegSingleRequest method createHttpClient.
public static Http2Socket createHttpClient(String id, boolean isHttp, InetSocketAddress addr) {
BufferPool pool2 = new TwoPools("pl", new SimpleMeterRegistry());
HpackParser hpackParser = HpackParserFactory.createParser(pool2, false);
Executor executor2 = Executors.newFixedThreadPool(10, new NamedThreadFactory("clientThread"));
ChannelManagerFactory factory = ChannelManagerFactory.createFactory(Metrics.globalRegistry);
ChannelManager mgr = factory.createMultiThreadedChanMgr("client", pool2, new BackpressureConfig(), executor2);
InjectionConfig injConfig = new InjectionConfig(hpackParser);
String host = addr.getHostName();
int port = addr.getPort();
ForTestSslClientEngineFactory ssl = new ForTestSslClientEngineFactory();
SSLEngine engine = ssl.createSslEngine(host, port);
Http2Client client = Http2ClientFactory.createHttpClient(id, mgr, injConfig);
Http2Socket socket;
if (isHttp) {
socket = client.createHttpSocket(new SocketListener());
} else {
socket = client.createHttpsSocket(engine, new SocketListener());
}
return socket;
}
Aggregations