use of org.webpieces.nio.api.channels.TCPChannel in project webpieces by deanhiller.
the class ProxyDataListener method failure.
@Override
public void failure(Channel channel, ByteBuffer data, Exception e) {
TCPChannel proxy = lookupExistingOrCreateNew(channel);
dataListener.failure(proxy, data, e);
}
use of org.webpieces.nio.api.channels.TCPChannel in project webpieces by deanhiller.
the class ProxyDataListener method connectionOpened.
public void connectionOpened(Channel channel, boolean isReadyForWrites) {
TCPChannel proxy = lookupExistingOrCreateNew(channel);
dataListener.connectionOpened(proxy, isReadyForWrites);
}
use of org.webpieces.nio.api.channels.TCPChannel 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.nio.api.channels.TCPChannel in project webpieces by deanhiller.
the class ProxyDataListener method incomingData.
@Override
public void incomingData(Channel channel, ByteBuffer b) {
TCPChannel proxy = lookupExistingOrCreateNew(channel);
dataListener.incomingData(proxy, b);
}
use of org.webpieces.nio.api.channels.TCPChannel in project webpieces by deanhiller.
the class ProxyDataListener method releaseBackPressure.
@Override
public void releaseBackPressure(Channel channel) {
TCPChannel proxy = lookupExistingOrCreateNew(channel);
dataListener.releaseBackPressure(proxy);
}
Aggregations