Package akka.io.Tcp

Examples of akka.io.Tcp.Connected


      } else {
        log.warning("unknown command failed [{}]", failed.cmd());
      }
    } else
    if (msg instanceof Connected) {
      final Connected conn = (Connected) msg;
      log.info("received connection from [{}]", conn.remoteAddress());
      final ActorRef connection = getSender();
      final ActorRef handler = getContext().actorOf(
          Props.create(handlerClass, connection, conn.remoteAddress()));
      //#echo-manager
      connection.tell(TcpMessage.register(handler,
          true, // <-- keepOpenOnPeerClosed flag
          true), getSelf());
      //#echo-manager
View Full Code Here


        @SuppressWarnings("unused")
        final ActorRef server = system.actorOf(Props.create(Server.class, getRef()), "server1");
        final InetSocketAddress listen = expectMsgClass(Bound.class).localAddress();
        final ActorRef client = system.actorOf(Props.create(Client.class, listen, getRef()), "client1");
       
        final Connected c1 = expectMsgClass(Connected.class);
        final Connected c2 = expectMsgClass(Connected.class);
        assert c1.localAddress().equals(c2.remoteAddress());
        assert c2.localAddress().equals(c1.remoteAddress());
       
        client.tell(ByteString.fromString("hello"), getRef());
        final ByteString reply = expectMsgClass(ByteString.class);
        assert reply.utf8String().equals("hello");
       
View Full Code Here

      } else if (msg instanceof CommandFailed) {
        getContext().stop(getSelf());
     
      } else if (msg instanceof Connected) {
        final Connected conn = (Connected) msg;
        manager.tell(conn, getSelf());
        final ActorRef handler = getContext().actorOf(
            Props.create(SimplisticHandler.class));
        getSender().tell(TcpMessage.register(handler), getSelf());
      }
View Full Code Here

         ofEventHandler = getContext().actorOf(Props.create(ofEventHandlerClass));
//         restApi = getContext().actorOf(Props.create(RestApiServer.class));
      } else if (msg instanceof CommandFailed) {
         getContext().stop(getSelf());
      } else if (msg instanceof Connected) {
         final Connected conn = (Connected) msg;
         manager.tell(conn, getSelf());
         System.out.println("[INFO] Getting Switch connection \n");
        
         //final ActorRef ofEventHandler = getContext().actorOf(Props.create(ofEventHandlerClass));
         handler = getContext().actorOf(Props.create(SwitchNurse.class));
View Full Code Here

TOP

Related Classes of akka.io.Tcp.Connected

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.