@Override
 public void preStart() throws Exception {
   // #pull-mode-bind
   tcp = Tcp.get(getContext().system()).manager();
   final List<Inet.SocketOption> options = new ArrayList<Inet.SocketOption>();
   tcp.tell(
       TcpMessage.bind(getSelf(), new InetSocketAddress("localhost", 0), 100, options, true),
       getSelf());
   // #pull-mode-bind
 }
Beispiel #2
0
 private void startServer(int port) {
   final InetSocketAddress endpoint = new InetSocketAddress("localhost", port);
   final Object bindCmd = TcpMessage.bind(getSelf(), endpoint, 100);
   Tcp.get(getContext().system()).getManager().tell(bindCmd, getSelf());
 }