use of org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher in project kontraktor by RuedigerMoeller.
the class Basics method testConnectionCloseOnCompleteNIO.
@Test
public void testConnectionCloseOnCompleteNIO() throws InterruptedException {
TCPNIOPublisher publisher = new TCPNIOPublisher().port(7854);
TCPConnectable connectable = new TCPConnectable().host("localhost").port(7854);
concloseTest(publisher, connectable);
Thread.sleep(5000);
System.out.println("break");
}
use of org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher in project kontraktor by RuedigerMoeller.
the class RxJava method remotingTest.
@Test
public void remotingTest() {
Observable<Integer> range = Observable.range(0, NUM_MSG / 4);
Publisher<Integer> pub = RxReactiveStreams.toPublisher(range);
KxReactiveStreams.get().asKxPublisher(pub).serve(new TCPNIOPublisher().port(3456));
RateMeasure rm = new RateMeasure("events");
AtomicInteger cnt = new AtomicInteger(0);
Promise<Integer> finished = new Promise<>();
KxReactiveStreams.get().connect(Integer.class, new TCPConnectable().host("localhost").port(3456)).subscribe((r, e) -> {
rm.count();
if (Actors.isResult(e))
cnt.incrementAndGet();
else
finished.resolve(cnt.get());
});
Assert.assertTrue(finished.await(50000) == NUM_MSG / 4);
}
use of org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher in project kontraktor by RuedigerMoeller.
the class RxJava method remotingRxToRx.
@Test
public void remotingRxToRx() throws InterruptedException {
Observable<Integer> range = Observable.range(0, NUM_MSG / 4);
Publisher<Integer> pub = RxReactiveStreams.toPublisher(range);
KxReactiveStreams.get().asKxPublisher(pub).serve(new TCPNIOPublisher().port(3458));
RateMeasure rm = new RateMeasure("events");
KxPublisher<Integer> remoteStream = KxReactiveStreams.get().connect(Integer.class, new TCPConnectable().host("localhost").port(3458));
CountDownLatch cnt = new CountDownLatch(NUM_MSG / 4);
RxReactiveStreams.toObservable(remoteStream).forEach(i -> {
rm.count();
cnt.countDown();
});
cnt.await(50, TimeUnit.SECONDS);
Assert.assertTrue(cnt.getCount() == 0);
}
use of org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher in project kontraktor by RuedigerMoeller.
the class TableSpaceTest method startShardServer.
@Test
public void startShardServer() throws InterruptedException {
startServer();
TableSpaceActor ts = Actors.AsActor(TableSpaceActor.class);
ts.init();
new TCPNIOPublisher(ts, 5433).publish(actor -> System.out.println("sidconnected: " + actor));
Thread.sleep(1000000);
}
use of org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher in project kontraktor by RuedigerMoeller.
the class TableSpaceTest method startServer.
public TableSpaceActor startServer() {
TableSpaceActor ts = Actors.AsActor(TableSpaceActor.class);
ts.init();
new TCPNIOPublisher(ts, 5432).publish(actor -> System.out.println("sidconnected: " + actor));
return ts;
}
Aggregations