Package com.firefly.net

Examples of com.firefly.net.Server


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


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 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

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

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

    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

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(), 6*1000);
        server.start("localhost", 9900);
    }
View Full Code Here

import com.firefly.net.tcp.TcpServer;

public class Test {

  public static void main(String[] args) throws Throwable {
    Server server = new TcpServer(new SSLDecoder(), new SSLEncoder(), new DumpHandler(), 1000 * 60)
    server.start("localhost", 7676);
  }
View Full Code Here

    log.info("enable thread pool [{}]", config.isEnableThreadPool());
    log.info("keep alive [{}]", config.isKeepAlive());
   
    if(config.isSecure()) {
      log.info("enable SSL");
      Server server = new TcpServer(
          new SSLDecoder(new HttpDecoder(config)),
          new SSLEncoder(),
          new HttpHandler(controller, config),
          config.getMaxConnectionTimeout());
      server.start(config.getHost(), config.getPort());
    } else {
      Server server = new TcpServer(
          new HttpDecoder(config),
          new HttpEncoder(),
          new HttpHandler(controller, config),
          config.getMaxConnectionTimeout());
      server.start(config.getHost(), config.getPort());
    }
  }
View Full Code Here

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

  @Test
  public void testHello() throws Throwable {
    Server server = new TcpServer();
    Config config = new Config();
    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(), new PipelineClientHandler());
View Full Code Here

TOP

Related Classes of com.firefly.net.Server

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.