use of org.webpieces.data.api.BufferCreationPool in project webpieces by deanhiller.
the class TestBasicSsl method createSvrChanMgr.
private ChannelManager createSvrChanMgr(String name) {
ExecutorService executor = Executors.newFixedThreadPool(10, new NamedThreadFactory(name));
ChannelManagerFactory factory = ChannelManagerFactory.createFactory();
ChannelManager svrMgr = factory.createMultiThreadedChanMgr(name + "Mgr", new BufferCreationPool(), executor);
return svrMgr;
}
use of org.webpieces.data.api.BufferCreationPool in project webpieces by deanhiller.
the class ServerFactory method createTestServer.
static int createTestServer(boolean alwaysHttp2, Long maxConcurrentStreams) {
BufferCreationPool pool = new BufferCreationPool();
ScheduledExecutorService timer = new ScheduledThreadPoolExecutor(1, new NamedThreadFactory("webpieces-timer"));
HttpFrontendManager frontEndMgr = HttpFrontendFactory.createFrontEnd("frontEnd", 10, timer, pool);
FrontendConfig config = new FrontendConfig("id2", new InetSocketAddress(0));
HttpServer server = frontEndMgr.createHttpServer(config, new OurListener());
server.start();
return server.getUnderlyingChannel().getLocalAddress().getPort();
}
use of org.webpieces.data.api.BufferCreationPool in project webpieces by deanhiller.
the class TestBasicSslClientServer method testBasic.
@Test
public void testBasic() throws InterruptedException {
pool = new BufferCreationPool();
ChannelManagerFactory factory = ChannelManagerFactory.createFactory();
ChannelManager mgr = factory.createSingleThreadedChanMgr("sslChanMgr", pool);
AsyncServerManager svrFactory = AsyncServerMgrFactory.createAsyncServer(mgr);
SSLEngineFactoryForTest f = new SSLEngineFactoryForTest();
InetSocketAddress addr = new InetSocketAddress("localhost", 0);
AsyncServer svr = svrFactory.createTcpServer(new AsyncConfig("sslTcpSvr"), new SvrDataListener(), f);
svr.start(addr);
InetSocketAddress bound = svr.getUnderlyingChannel().getLocalAddress();
System.out.println("port=" + bound.getPort());
TCPChannel channel = mgr.createTCPChannel("client", f.createEngineForSocket());
CompletableFuture<Channel> connect = channel.connect(bound, new ClientListener());
connect.thenAccept(c -> writeData(c));
synchronized (pool) {
while (values.size() < 10) pool.wait();
}
for (int i = 0; i < values.size(); i++) {
Assert.assertEquals(new Integer(i), values.get(i));
}
}
use of org.webpieces.data.api.BufferCreationPool 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.data.api.BufferCreationPool in project webpieces by deanhiller.
the class HttpFrontendFactory method createFrontEnd.
public static HttpFrontendManager createFrontEnd(ChannelManager chanMgr, ScheduledExecutorService timer, InjectionConfig injConfig) {
BufferCreationPool pool = new BufferCreationPool();
HttpParser httpParser = HttpParserFactory.createParser(pool);
return createFrontEnd(chanMgr, timer, injConfig, httpParser);
}
Aggregations