use of org.apache.mina.core.service.IoHandlerAdapter in project streamsx.topology by IBMStreams.
the class TupleCollection method addTCPServerAndSink.
/**
* Add a TCP server that will list for tuples to be directed to handlers.
* Adds a sink to the topology to capture those tuples and deliver them to
* the current jvm to run Junit type tests.
*/
private void addTCPServerAndSink() throws Exception {
tcpServer = new TCPTestServer(0, new IoHandlerAdapter() {
@Override
public void messageReceived(IoSession session, Object message) throws Exception {
TestTuple tuple = (TestTuple) message;
TestTupleInjector injector = injectors.get(tuple.getTesterId());
injector.tuple(tuple.getTupleData());
}
});
InetSocketAddress testAddr = tcpServer.start();
addTesterSink(testAddr);
}
Aggregations