use of org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher in project kontraktor by RuedigerMoeller.
the class Pong method main.
public static void main(String[] args) {
Pong pong = AsActor(Pong.class);
new TCPNIOPublisher().port(9080).serType(SerializerType.FSTSer).facade(pong).publish(x -> Log.Info(Pong.class, "disconnected " + x));
// we need to initiate ping pong. Assumes Ping is already running
Ping ping = (Ping) new TCPConnectable().host("localhost").port(9080).actorClass(Ping.class).serType(SerializerType.FSTSer).connect().await();
ping.receivePong(pong);
}
use of org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher in project kontraktor by RuedigerMoeller.
the class RemotingTest method test.
@Test
public void test() {
RemotingTA serv = Actors.AsActor(RemotingTA.class);
// websocket
WebSocketPublisher pub = new WebSocketPublisher().facade(serv).hostName("0.0.0.0").urlPath("/websocket").port(7777).serType(SerializerType.FSTSer);
pub.publish().await();
WebSocketConnectable con = new WebSocketConnectable().actorClass(RemotingTA.class).url("ws://localhost:7777/websocket");
fromRemote(con);
// TCP NIO
new TCPNIOPublisher(serv, 7778).publish().await();
fromRemote(new TCPConnectable(RemotingTA.class, "localhost", 7778));
// TCP Sync
new TCPPublisher(serv, 7780).publish().await();
fromRemote(new TCPConnectable(RemotingTA.class, "localhost", 7780));
// Http-Longpoll
new HttpPublisher(serv, "0.0.0.0", "/httpapi", 7779).publish().await();
fromRemote(new HttpConnectable(RemotingTA.class, "http://localhost:7779/httpapi"));
}
Aggregations