Ejemplo n.º 1
0
  @Test
  public void testSimple() throws Exception {

    IServer server = new Server(new ServerHandler());
    server.start();

    IBlockingConnection con = new BlockingConnection("localhost", server.getLocalPort());

    con.write("A test\r\n");
    String response = con.readStringByDelimiter("\r\n");
    Assert.assertEquals("OK", response);

    con.write("other\r\n");
    response = con.readStringByDelimiter("\r\n");
    Assert.assertEquals("other failed", response);

    System.out.println("finished");
    con.close();
    server.close();
  }