use of org.nustaq.kontraktor.reactivestreams.EventSink in project kontraktor by RuedigerMoeller.
the class TCPNIOKStreamsTest method testServer.
@Test
@Ignore
public void testServer() throws InterruptedException {
AtomicLong counter = new AtomicLong(0);
EventSink<String> stringStream = new EventSink<>();
stringStream.serve(getRemotePublisher(), actor -> {
System.out.println("disconnect of " + actor);
});
int prev = 0;
long l = System.currentTimeMillis();
while (true) {
long cn = counter.get();
if (stringStream.offer("" + cn)) {
counter.incrementAndGet();
}
if (System.currentTimeMillis() - l > 1000) {
System.out.println("sent:" + cn);
System.out.println(" :" + (cn - prev));
prev = (int) cn;
l = System.currentTimeMillis();
}
}
}
Aggregations