Package com.firefly.net.support

Examples of com.firefly.net.support.MessageReceiveCallBack


    @Override
    public void run() {
      TcpConnection c = client.connect();
      for (int i = 0; i < LOOP; i++) {
        String message = "hello world! " + c.getId();
        c.send(message, new MessageReceiveCallBack() {

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

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

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


public class SimpleTcpClientExample {
  public static void main(String[] args) {
    final SimpleTcpClient client = new SimpleTcpClient("localhost", 9900,
        new StringLineDecoder(), new StringLineEncoder());
    TcpConnection c = client.connect();
    c.send("hello client 1", new MessageReceiveCallBack() {

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

      }
    });

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

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

      }
    });

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

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

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

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

    @Override
    public void run() {
      TcpConnection c = tcpConnections[id];
      for (int i = 0; i < LOOP; i++) {
//        String message = "hello world! " + c.getId();
        c.send(DATA, new MessageReceiveCallBack() {

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

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

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

TOP

Related Classes of com.firefly.net.support.MessageReceiveCallBack

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.