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

Examples of com.firefly.net.support.wrap.client.SimpleTcpClient.connect()


        }
      });

    }

    TcpConnection c = client.connect().get();
    try {
      Assert.assertThat((String) c.send("hello client 2").get(), is("hello client 2"));
      Assert.assertThat((String) c.send("quit").get(), is("bye!"));
    } finally {
      c.close(false);
View Full Code Here


public class SimpleTcpClientExample {
  public static void main(String[] args) throws Throwable {
    final SimpleTcpClient client = new SimpleTcpClient("localhost", 9900, new StringLineDecoder(), new StringLineEncoder(), new PipelineClientHandler());
    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() {
View Full Code Here

      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();
View Full Code Here

        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());
View Full Code Here

      executorService.submit(new Runnable() {
        @Override
        public void run() {
          TcpConnection c = null;
          try {
            c = client.connect().get();
          } catch (InterruptedException e) {
            e.printStackTrace();
          } catch (ExecutionException e) {
            e.printStackTrace();
          }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.