Package test.net.tcp.example

Examples of test.net.tcp.example.StringLineDecoder


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


  }

  public static void main(String[] args) {
    ExecutorService executorService = Executors.newFixedThreadPool(THREAD);
    final SimpleTcpClient client = new SimpleTcpClient("localhost", 9900,
        new StringLineDecoder(), new StringLineEncoder(), new PipelineClientHandler());
    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.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

import com.firefly.net.support.wrap.client.TcpConnection;
import com.firefly.utils.log.LogFactory;

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

  @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());

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

TOP

Related Classes of test.net.tcp.example.StringLineDecoder

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.