use of org.webpieces.nio.api.ChannelManagerFactory in project webpieces by deanhiller.
the class AsyncServerMgrFactory method createAsyncServer.
public static AsyncServerManager createAsyncServer(String id, BufferPool pool) {
ExecutorService executor = Executors.newFixedThreadPool(10);
ChannelManagerFactory factory = ChannelManagerFactory.createFactory();
ChannelManager mgr = factory.createMultiThreadedChanMgr(id, pool, executor);
return createAsyncServer(mgr);
}
use of org.webpieces.nio.api.ChannelManagerFactory 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 BufferCreationPool();
ChannelManagerFactory factory = ChannelManagerFactory.createFactory();
ChannelManager mgr = factory.createMultiThreadedChanMgr("server", pool, executor);
AsyncServerManager serverMgr = AsyncServerMgrFactory.createAsyncServer(mgr);
AsyncServer server = serverMgr.createTcpServer(new AsyncConfig("tcpServer"), new IntegTestLocalhostServerListener());
server.start(new InetSocketAddress(8080));
client.start(8080);
synchronized (this) {
this.wait();
}
}
use of org.webpieces.nio.api.ChannelManagerFactory in project webpieces by deanhiller.
the class IntegTestLocalhostThroughput method createClientChannel.
private TCPChannel createClientChannel(BufferPool pool2, Executor executor) {
ChannelManagerFactory factory = ChannelManagerFactory.createFactory();
ChannelManager mgr = factory.createMultiThreadedChanMgr("client", pool2, executor);
TCPChannel channel = mgr.createTCPChannel("clientChan");
return channel;
}
use of org.webpieces.nio.api.ChannelManagerFactory in project webpieces by deanhiller.
the class HttpFrontendFactory method createFrontEnd.
/**
*
* @param id Use for logging and also file recording names
* @param threadPoolSize The size of the threadpool, although all data comes in order as we
* use the SessionExecutorImpl found in webpieces
*
* @return
*/
public static HttpFrontendManager createFrontEnd(String id, int threadPoolSize, ScheduledExecutorService timer, BufferPool pool) {
Executor executor = Executors.newFixedThreadPool(threadPoolSize, new NamedThreadFactory(id));
ChannelManagerFactory factory = ChannelManagerFactory.createFactory();
ChannelManager chanMgr = factory.createMultiThreadedChanMgr(id, pool, executor);
AsyncServerManager svrMgr = AsyncServerMgrFactory.createAsyncServer(chanMgr);
HttpParser httpParser = HttpParserFactory.createParser(pool);
HpackParser http2Parser = HpackParserFactory.createParser(pool, true);
InjectionConfig injConfig = new InjectionConfig(http2Parser, new TimeImpl(), new Http2Config());
Http2ServerEngineFactory svrEngineFactory = new Http2ServerEngineFactory(injConfig);
return new FrontEndServerManagerImpl(svrMgr, timer, svrEngineFactory, httpParser);
}
use of org.webpieces.nio.api.ChannelManagerFactory 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;
}
Aggregations