use of org.webpieces.nio.api.BackpressureConfig in project webpieces by deanhiller.
the class IntegTestClientToEchoServer method createClientChannel.
private TCPChannel createClientChannel(BufferPool pool2, Executor executor) {
ChannelManagerFactory factory = ChannelManagerFactory.createFactory(Metrics.globalRegistry);
ChannelManager mgr = factory.createMultiThreadedChanMgr("client", pool2, new BackpressureConfig(), executor);
TCPChannel channel = mgr.createTCPChannel("clientChan");
return channel;
}
use of org.webpieces.nio.api.BackpressureConfig in project webpieces by deanhiller.
the class IntegTestLocalhostThroughput method testThroughput.
public void testThroughput() throws InterruptedException, ExecutionException, TimeoutException {
Executor executor = Executors.newFixedThreadPool(10, new NamedThreadFactory("serverThread"));
BufferPool pool = new TwoPools("p1", new SimpleMeterRegistry());
BackpressureConfig config = new BackpressureConfig();
config.setMaxBytes(16_384 * 10);
config.setStartReadingThreshold(512);
ChannelManager mgr = createChanMgr("server", executor, pool, config);
AsyncServerManager serverMgr = AsyncServerMgrFactory.createAsyncServer(mgr, Metrics.globalRegistry);
AsyncServer server = serverMgr.createTcpServer(new AsyncConfig("tcpServer"), new AsyncServerDataListener(recorder, pool));
server.start(new InetSocketAddress(8080));
BufferPool pool2 = new TwoPools("p2", new SimpleMeterRegistry());
DataListener listener = new ClientDataListener(pool2, recorder);
Executor executor2 = Executors.newFixedThreadPool(10, new NamedThreadFactory("clientThread"));
TCPChannel channel = createClientChannel(pool2, executor2, config);
recorder.setClientChannel(channel);
recorder.start();
XFuture<Void> connect = channel.connect(new InetSocketAddress(8080), listener);
connect.get(2, TimeUnit.SECONDS);
synchronized (this) {
this.wait();
}
}
use of org.webpieces.nio.api.BackpressureConfig 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;
}
use of org.webpieces.nio.api.BackpressureConfig in project webpieces by deanhiller.
the class IntegTestEchoClientToOurServer method testSoTimeoutOnSocket.
public void testSoTimeoutOnSocket() throws InterruptedException {
EchoClient client = new EchoClient();
Executor executor = Executors.newFixedThreadPool(10, new NamedThreadFactory("serverThread"));
BufferPool pool = new TwoPools("pl", new SimpleMeterRegistry());
ChannelManagerFactory factory = ChannelManagerFactory.createFactory(Metrics.globalRegistry);
ChannelManager mgr = factory.createMultiThreadedChanMgr("server", pool, new BackpressureConfig(), executor);
AsyncServerManager serverMgr = AsyncServerMgrFactory.createAsyncServer(mgr, Metrics.globalRegistry);
AsyncServer server = serverMgr.createTcpServer(new AsyncConfig("tcpServer"), null);
server.start(new InetSocketAddress(8080));
client.start(8080);
synchronized (this) {
this.wait();
}
}
use of org.webpieces.nio.api.BackpressureConfig 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;
}
Aggregations