Examples of TcpServer


Examples of com.firefly.net.tcp.TcpServer

public class TestTcpClientAndServer {
  private static Log log = LogFactory.getInstance().getLog("firefly-system");

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

Examples of com.firefly.net.tcp.TcpServer

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

Examples of com.firefly.net.tcp.TcpServer

import com.firefly.net.tcp.TcpServer;

public class StringLineTcpServer {

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

Examples of com.firefly.net.tcp.TcpServer

public class TestTcpClientAndServer {
  private static Log log = LogFactory.getInstance().getLog("firefly-system");

    @Test
    public void testHello() {
        Server server = new TcpServer();
        Config config = new Config();
        config.setHandleThreads(-1);
        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 Client client = new TcpClient(new StringLineDecoder(),
                new StringLineEncoder(), new StringLineClientHandler());
View Full Code Here

Examples of com.firefly.net.tcp.TcpServer

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);
//        server.shutdown();
    }
View Full Code Here

Examples of com.firefly.net.tcp.TcpServer

import com.firefly.net.tcp.TcpServer;

public class StringLineTcpServer {

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

Examples of com.firefly.net.tcp.TcpServer

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("10.147.22.162", 9900);
//        server.shutdown();
    }
View Full Code Here

Examples of com.firefly.net.tcp.TcpServer

import com.firefly.net.tcp.TcpServer;

public class StringLineTcpServer {

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

Examples of com.firefly.net.tcp.TcpServer

    HttpServletDispatcherController controller = HttpServletDispatcherController
        .getInstance().init(context);

    config.setEncoding(context.getEncoding());

    Server server = new TcpServer(new HttpDecoder(config),
        new HttpEncoder(), new HttpHandler(controller, config));
    server.start(config.getHost(), config.getPort());
    long end = System.currentTimeMillis();
    log.info("firefly startup in {} ms", (end - start));
  }
View Full Code Here

Examples of com.firefly.net.tcp.TcpServer

      System.setProperty("bind_host", "localhost");
      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
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.