Package com.firefly.net.support

Examples of com.firefly.net.support.StringLineEncoder


  }

  public static void main(String[] args) {
    ExecutorService executorService = Executors.newFixedThreadPool(THREAD);
    final SimpleTcpClient client = new SimpleTcpClient("localhost", 9900,
        new StringLineDecoder(), new StringLineEncoder());
    final CyclicBarrier barrier = new CyclicBarrier(THREAD, new StatTask());

    for (int i = 0; i < THREAD; i++)
      executorService.submit(new ClientSynchronizeTask(client, barrier));
View Full Code Here


import com.firefly.net.support.TcpConnection;

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

  public void testHello() {
    Server server = new TcpServer();
    Config config = new Config();
    config.setHandleThreads(100);
    config.setDecoder(new StringLineDecoder());
    config.setEncoder(new StringLineEncoder());
    config.setHandler(new SendFileHandler());
    server.setConfig(config);
    server.start("localhost", 9900);

    final int LOOP = 50;
    ExecutorService executorService = Executors.newFixedThreadPool(LOOP);
    final SimpleTcpClient client = new SimpleTcpClient("localhost", 9900,
        new StringLineDecoder(), new StringLineEncoder());

    for (int i = 0; i < LOOP; i++) {
      executorService.submit(new Runnable() {
        @Override
        public void run() {
View Full Code Here

public class FileTransferTcpServer {

    public static void main(String[] args) throws URISyntaxException {
//    System.out.println(SendFileHandler.class.getResource("/testFile.txt").toURI());
        Server server = new TcpServer(new StringLineDecoder(),
                new StringLineEncoder(), new SendFileHandler());
        server.start("localhost", 9900);
    }
View Full Code Here

public class StringLineTcpServer {

    public static void main(String[] args) {
        new TcpServer(new StringLineDecoder(),
                new StringLineEncoder(), new StringLineHandler()).start("localhost", 9900);
    }
View Full Code Here

    DATA = new String(data);
   

    ExecutorService executorService = Executors.newFixedThreadPool(THREAD);
    final SimpleTcpClient client = new SimpleTcpClient(host, port,
        new StringLineDecoder(), new StringLineEncoder());
    for (int i = 0; i < THREAD; i++) {
      tcpConnections[i] = client.connect();
    }
    final CyclicBarrier barrier = new CyclicBarrier(THREAD, new StatTask());
View Full Code Here

      System.setProperty("bind_port", "9900");
     
      String host = System.getProperty("bind_host");
      int port = Integer.parseInt(System.getProperty("bind_port"));
        new TcpServer(new StringLineDecoder(),
                new StringLineEncoder(), new StringLineHandler()).start(host, port);
    }
View Full Code Here

TOP

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

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.