Package com.firefly.net.support.wrap.client

Examples of com.firefly.net.support.wrap.client.MessageReceivedCallback


      } catch (ExecutionException e1) {
        e1.printStackTrace();
      }
      for (int i = 0; i < LOOP; i++) {
        String message = "hello world! " + c.getId();
        c.send(message, new MessageReceivedCallback() {

          @Override
          public void messageRecieved(TcpConnection connection, Object obj) {
            log.debug("rev: {}", obj);
          }
        });

      }
      c.send("quit", new MessageReceivedCallback() {

        @Override
        public void messageRecieved(TcpConnection connection, Object obj) {
          log.debug("rev: {}", obj);
          log.debug("session {} complete", connection.getId());
View Full Code Here


    long start = System.currentTimeMillis();
    TcpConnection c = client.connect().get();
    long end = System.currentTimeMillis();
    System.out.println("connection 0 creating time is " + (end - start));
    System.out.println("current conn id: " + c.getId());
    c.send("hello client 1", new MessageReceivedCallback() {

      @Override
      public void messageRecieved(TcpConnection connection, Object obj) {
        System.out.println("con1|" + obj.toString());

      }
    });

    c.send("test client 2", new MessageReceivedCallback() {

      @Override
      public void messageRecieved(TcpConnection connection, Object obj) {
        System.out.println("con1|" + obj.toString());

      }
    });

    c.send("test client 3", new MessageReceivedCallback() {

      @Override
      public void messageRecieved(TcpConnection connection, Object obj) {
        System.out.println("con1|" + obj.toString());
      }
    });

    c.send("quit", new MessageReceivedCallback() {

      @Override
      public void messageRecieved(TcpConnection connection, Object obj) {
        System.out.println("con1|" + obj.toString());
      }
    });

    Future<TcpConnection> fc2 = client.connect();
    Future<TcpConnection> fc3 = client.connect();
   
   
    TcpConnection c2 = fc2.get();
    TcpConnection c3 = fc3.get();
    System.out.println("con2|" + c2.send("getfile").get());
    c2.close(false);
   
    c3.send("test c3", new MessageReceivedCallback() {

      @Override
      public void messageRecieved(TcpConnection connection, Object obj) {
        System.out.println("con3|" + obj.toString());
      }
View Full Code Here

TOP

Related Classes of com.firefly.net.support.wrap.client.MessageReceivedCallback

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.