Examples of TcpConnection


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

    private final SimpleTcpClient client;
    private final CyclicBarrier barrier;

    @Override
    public void run() {
      TcpConnection c = null;
      try {
        c = client.connect().get();
      } catch (InterruptedException e1) {
        e1.printStackTrace();
      } 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

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

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() {

      @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());
      }
    });
    c3.close(true);;
   
    Thread.sleep(4000);
    client.shutdown();
    LogFactory.getInstance().shutdown();
//    System.out.println("shutdown");
View Full Code Here

Examples of etch.util.core.io.TcpConnection

    TransportData c = null;
   
    if (isSecure)
      c = new TlsConnection( (SSLSocket) socket, u, resources );
    else
      c = new TcpConnection( (Socket) socket, u, resources );
   
    TransportPacket p = new Packetizer( c, u, resources );
   
    TransportMessage m = new Messagizer( p, u, resources );
   
View Full Code Here

Examples of etch.util.core.io.TcpConnection

    TransportData c = null;
   
    if (isSecure)
      c = new TlsConnection( (SSLSocket) socket, u, resources );
    else
      c = new TcpConnection( (Socket) socket, u, resources );
   
    TransportPacket p = new Packetizer( c, u, resources );
   
    TransportMessage m = new Messagizer( p, u, resources );
   
View Full Code Here

Examples of org.apache.etch.util.core.io.TcpConnection

    TransportData c = null;
   
    if (isSecure)
      c = new TlsConnection( (SSLSocket) socket, u, resources );
    else
      c = new TcpConnection( (Socket) socket, u, resources );
   
    TransportPacket p = new Packetizer( c, u, resources );
   
    TransportMessage m = new Messagizer( p, u, resources );
   
View Full Code Here

Examples of org.apache.harmony.rmi.transport.tcp.TcpConnection

        Socket s = ep.createSocket();

        if (s instanceof HttpOutboundSocket) {
            conn = new HttpConnection(s, ep);
        } else {
            conn = new TcpConnection(s, ep);
        }

        synchronized (connsTable) {
            Set conns = (Set) connsTable.get(ep);
View Full Code Here

Examples of org.apache.harmony.rmi.transport.tcp.TcpConnection

        Socket s = ep.createSocket();

        if (s instanceof HttpOutboundSocket) {
            conn = new HttpConnection(s, ep);
        } else {
            conn = new TcpConnection(s, ep);
        }

        synchronized (connsTable) {
            Set conns = (Set) connsTable.get(ep);
View Full Code Here

Examples of org.apache.harmony.rmi.transport.tcp.TcpConnection

        Socket s = ep.createSocket();

        if (s instanceof HttpOutboundSocket) {
            conn = new HttpConnection(s, ep);
        } else {
            conn = new TcpConnection(s, ep);
        }

        synchronized (connsTable) {
            Set conns = (Set) connsTable.get(ep);
View Full Code Here

Examples of org.jacoco.agent.rt.internal.output.TcpConnection

    final OutputStream remoteOut = mockConnection.getSocketB()
        .getOutputStream();
    remoteOut.write(0x01);
    remoteOut.write(0xC0);
    remoteOut.write(0xCA);
    final TcpConnection connection = new TcpConnection(
        mockConnection.getSocketA(), data);
    connection.init();
    connection.run();
  }
View Full Code Here

Examples of org.jacoco.agent.rt.internal.output.TcpConnection

  @Test(expected = IOException.class)
  public void testInvalidContent() throws Exception {
    final OutputStream remoteOut = mockConnection.getSocketB()
        .getOutputStream();
    new ExecutionDataWriter(remoteOut);
    final TcpConnection con = new TcpConnection(
        mockConnection.getSocketA(), data);
    con.init();
    remoteOut.write(123);
    con.run();
  }
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.