use of org.webpieces.util.threading.DirectExecutor 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.util.threading.DirectExecutor in project webpieces by deanhiller.
the class TestReading method setup.
@Before
public void setup() throws InterruptedException, ExecutionException, TimeoutException {
ChannelManagerFactory factory = ChannelManagerFactory.createFactory(mockJdk, Metrics.globalRegistry);
DirectExecutor exec = new DirectExecutor();
BackpressureConfig config = new BackpressureConfig();
config.setMaxBytes(6);
config.setStartReadingThreshold(2);
mgr = factory.createMultiThreadedChanMgr("test'n", new TwoPools("pl", new SimpleMeterRegistry()), config, exec);
listener = new MockDataListener();
channel = mgr.createTCPChannel("myid");
mockChannel.addConnectReturnValue(true);
mockJdk.setThread(Thread.currentThread());
XFuture<Void> future = channel.connect(new InetSocketAddress(4444), listener);
future.get(2, TimeUnit.SECONDS);
Assert.assertTrue(mockChannel.isRegisteredForReads());
}
use of org.webpieces.util.threading.DirectExecutor in project webpieces by deanhiller.
the class TestWriting method setup.
@Before
public void setup() throws InterruptedException, ExecutionException, TimeoutException {
ChannelManagerFactory factory = ChannelManagerFactory.createFactory(mockJdk, Metrics.globalRegistry);
DirectExecutor exec = new DirectExecutor();
mgr = factory.createMultiThreadedChanMgr("test'n", new TwoPools("pl", new SimpleMeterRegistry()), new BackpressureConfig(), exec);
MockDataListener listener = new MockDataListener();
channel = mgr.createTCPChannel("myid");
mockChannel.addConnectReturnValue(true);
mockJdk.setThread(Thread.currentThread());
XFuture<Void> future = channel.connect(new InetSocketAddress(4444), listener);
future.get(2, TimeUnit.SECONDS);
Assert.assertTrue(mockChannel.isRegisteredForReads());
}
Aggregations