use of org.webpieces.data.api.TwoPools in project webpieces by deanhiller.
the class TestBasicSslClientServer method testBasic.
@Test
public void testBasic() throws InterruptedException, ExecutionException, TimeoutException {
pool = new TwoPools("pl", new SimpleMeterRegistry());
MeterRegistry meters = Metrics.globalRegistry;
ChannelManagerFactory factory = ChannelManagerFactory.createFactory(meters);
ChannelManager mgr = factory.createSingleThreadedChanMgr("sslChanMgr", pool, new BackpressureConfig());
AsyncServerManager svrFactory = AsyncServerMgrFactory.createAsyncServer(mgr, meters);
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());
XFuture<Void> connect = channel.connect(bound, new ClientListener());
connect.get(10000000, TimeUnit.SECONDS);
writeData(channel);
synchronized (pool) {
while (values.size() < 10) pool.wait();
}
for (int i = 0; i < values.size(); i++) {
Integer expected = i;
Assert.assertEquals(expected, values.get(i));
}
}
use of org.webpieces.data.api.TwoPools in project webpieces by deanhiller.
the class TestAccepting method setup.
@Before
public void setup() {
MeterRegistry meters = Metrics.globalRegistry;
ChannelManagerFactory factory = ChannelManagerFactory.createFactory(mockJdk, meters);
ChannelManager mgr = factory.createMultiThreadedChanMgr("test'n", new TwoPools("pl", new SimpleMeterRegistry()), new BackpressureConfig(), new DirectExecutor());
svrMgr = AsyncServerMgrFactory.createAsyncServer(mgr, meters);
}
use of org.webpieces.data.api.TwoPools in project webpieces by deanhiller.
the class TestSslCloseSvr method createServer.
private AsyncServer createServer() {
MeterRegistry meters = Metrics.globalRegistry;
SSLEngineFactoryForTestOld sslFactory = new SSLEngineFactoryForTestOld();
ChannelManagerFactory factory = ChannelManagerFactory.createFactory(mockJdk, meters);
ChannelManager mgr = factory.createMultiThreadedChanMgr("test'n", new TwoPools("pl", new SimpleMeterRegistry()), new BackpressureConfig(), new DirectExecutor());
AsyncServerManager svrMgr = AsyncServerMgrFactory.createAsyncServer(mgr, meters);
AsyncServer server1 = svrMgr.createTcpServer(new AsyncConfig(), listener, sslFactory);
return server1;
}
use of org.webpieces.data.api.TwoPools in project webpieces by deanhiller.
the class TestSslCloseSvr method createClientParser.
private SSLParser createClientParser() {
SSLEngineFactoryForTestOld sslFactory = new SSLEngineFactoryForTestOld();
BufferPool pool = new TwoPools("p1", new SimpleMeterRegistry());
SSLEngine clientSsl = sslFactory.createEngineForSocket();
SSLMetrics sslMetrics = new SSLMetrics("", new SimpleMeterRegistry());
SSLParser clientSslParser1 = AsyncSSLFactory.create("svr", clientSsl, pool, sslMetrics);
return clientSslParser1;
}
use of org.webpieces.data.api.TwoPools 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();
}
}
Aggregations