use of org.webpieces.nio.api.handlers.ConnectionListener in project webpieces by deanhiller.
the class TestNewChannelManager method setUp.
protected void setUp() throws Exception {
HandlerForTests.setupLogging();
server = ChannelManagerFactory.createChannelManager("server", null);
client = ChannelManagerFactory.createChannelManager("client", null);
loopBack = InetAddress.getByName("127.0.0.1");
loopBackAnyPort = new InetSocketAddress(loopBack, 0);
serverAccept = MockObjectFactory.createMock(ConnectionListener.class);
srvrChannel = server.createTCPServerChannel("jmxServer");
srvrChannel.setReuseAddress(true);
srvrChannel.bind(loopBackAnyPort);
srvrChannel.registerServerSocketChannel((ConnectionListener) serverAccept);
clientHandler = MockObjectFactory.createMock(DataListener.class);
clientConnect = MockObjectFactory.createMock(OperationCallback.class);
client1 = client.createTCPChannel("ClientChannel");
}
use of org.webpieces.nio.api.handlers.ConnectionListener in project webpieces by deanhiller.
the class TestS3InitialHttpConnections method setUp.
@Before
public void setUp() throws InterruptedException, ExecutionException, TimeoutException {
MockTcpServerChannel svrChannel = new MockTcpServerChannel();
mockChanMgr.addTCPSvrChannelToReturn(svrChannel);
mockTcpChannel.setIncomingFrameDefaultReturnValue(CompletableFuture.completedFuture(mockTcpChannel));
mockListener.setDefaultRetVal(mockStreamWriter);
mockStreamWriter.setDefaultRetValToThis();
Http2Config config = new Http2Config();
config.setLocalSettings(localSettings);
InjectionConfig injConfig = new InjectionConfig(mockTime, config);
FrontendConfig frontendConfig = new FrontendConfig("http", new InetSocketAddress("me", 8080));
HttpFrontendManager manager = HttpFrontendFactory.createFrontEnd(mockChanMgr, mockTimer, injConfig);
HttpServer httpServer = manager.createHttpServer(frontendConfig, mockListener);
httpServer.start();
ConnectionListener listener = mockChanMgr.getSingleConnectionListener();
CompletableFuture<DataListener> futureList = listener.connected(mockTcpChannel, true);
DataListener dataListener = futureList.get(3, TimeUnit.SECONDS);
mockChannel.setDataListener(dataListener);
}
use of org.webpieces.nio.api.handlers.ConnectionListener in project webpieces by deanhiller.
the class AbstractHttp2Test method simulateClientConnecting.
private void simulateClientConnecting() throws InterruptedException, ExecutionException, TimeoutException {
ConnectionListener listener = mockChanMgr.getSingleConnectionListener();
CompletableFuture<DataListener> futureList = listener.connected(mockTcpChannel, true);
DataListener dataListener = futureList.get(3, TimeUnit.SECONDS);
mockChannel.setDataListener(dataListener);
}
use of org.webpieces.nio.api.handlers.ConnectionListener in project webpieces by deanhiller.
the class AbstractHttp1Test method simulateClientConnecting.
private void simulateClientConnecting() throws InterruptedException, ExecutionException, TimeoutException {
ConnectionListener listener = mockChanMgr.getSingleConnectionListener();
CompletableFuture<DataListener> futureList = listener.connected(mockChannel, true);
DataListener dataListener = futureList.get(3, TimeUnit.SECONDS);
mockChannel.setDataListener(dataListener);
}
use of org.webpieces.nio.api.handlers.ConnectionListener in project webpieces by deanhiller.
the class Http11ClientSimulator method openHttp.
public Http11Socket openHttp() {
ConnectionListener listener = mgr.getHttpConnection();
MockTcpChannel channel = new MockTcpChannel(parser);
CompletableFuture<DataListener> connected = listener.connected(channel, true);
try {
DataListener dataListener = connected.get(2, TimeUnit.SECONDS);
return new Http11Socket(dataListener, channel, parser);
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
Aggregations