public void testQuickServerLostCon() {
    try {
      assertEquals(0, TestEventHandler.getGotConnectedFlag());
      assertEquals(0, TestEventHandler.getClosingConnectionFlag());
      assertEquals(0, TestEventHandler.getLostConnectionFlag());
      assertEquals(0, TestCommandHandler.getHandleCommandFlag());

      client.connect(host, port);
      sleep(50);
      assertEquals(1, TestEventHandler.getGotConnectedFlag());
      System.out.println("GotConnected Pass");

      client.sendString("test1");
      sleep(50);
      assertEquals(1, TestCommandHandler.getHandleCommandFlag());
      assertEquals("test1", TestCommandHandler.getRequest());
      System.out.println("HandleCommand 1 Pass");

      client.close();
      sleep(50);
      assertEquals(1, TestEventHandler.getLostConnectionFlag());
      System.out.println("LostConnection Pass");

    } catch (Exception e) {
      fail("Exception: " + e);
    }
  }
  public void setUp() {
    server = new QuickServer();
    client = new BlockingClient();
    configServer();

    server.initService(config);

    TestEventHandler.reset();
    TestCommandHandler.reset();

    try {
      server.startServer();
    } catch (Exception e) {
      server = null;
      fail("Server could not start: " + e);
    }
  }
  public void testQuickServerBasic() {
    try {
      assertEquals(0, TestEventHandler.getGotConnectedFlag());
      assertEquals(0, TestEventHandler.getClosingConnectionFlag());
      assertEquals(0, TestEventHandler.getLostConnectionFlag());
      assertEquals(0, TestCommandHandler.getHandleCommandFlag());

      client.connect(host, port);
      sleep(50);
      assertEquals(1, TestEventHandler.getGotConnectedFlag());
      System.out.println("GotConnected Pass");

      client.sendString("test1");
      sleep(50);
      assertEquals(1, TestCommandHandler.getHandleCommandFlag());
      assertEquals("test1", TestCommandHandler.getRequest());
      System.out.println("HandleCommand 1 Pass");

      TestCommandHandler.setResponse("junit");
      client.sendString("test2");
      sleep(50);
      assertEquals(2, TestCommandHandler.getHandleCommandFlag());
      assertEquals("test2", TestCommandHandler.getRequest());
      assertEquals("junit", client.readString());
      System.out.println("HandleCommand 2 Pass");

      TestCommandHandler.setResponse("quit");
      client.sendString("test3");
      sleep(50);
      assertEquals(3, TestCommandHandler.getHandleCommandFlag());
      assertEquals(1, TestEventHandler.getClosingConnectionFlag());
      System.out.println("ClosingConnection Pass");

      sleep(100);
      assertTrue(client.readString() == null);
      System.out.println("isConnected Pass");
      client.close();
    } catch (Exception e) {
      fail("Exception: " + e);
    }
  }