/** JUnit test that runs server and client */
  @Test(timeout = 20000)
  public void runScanServer() throws Exception {
    TestSettings.init();
    final ScanServerImpl server_impl = new ScanServerImpl();
    try {
      server_impl.start();
    } catch (Exception ex) {
      if (ex.getMessage().startsWith("Cannot start")) {
        System.out.println("Server probably alreay running, skipping ScanServerHeadlessTest:");
        ex.printStackTrace();
        return;
      }
    }
    System.out.println("Scan Server running...");
    server = server_impl;

    // In another thread, try the client
    final Thread client = new Thread(this, "Client");
    client.start();
    // Wait for client to finish
    client.join();

    if (client_error != null) {
      client_error.printStackTrace();
      fail();
    }

    System.out.println("Scan Server exiting.");
    server_impl.stop();
  }
예제 #2
0
 @Before
 public void initTestSettings() {
   TestSettings.init();
 }