public void startApp() throws Exception { ap = new AppThread(); ap.start(); for (int x = 0; x < 10; x++) { // try to make a query.. if it doesnt work then sleep TestLogger.get().info("Trying to ping test server.."); if (Client.getInstance().isListening()) break; if (x == 9) throw new Exception("Could not contact test server"); Thread.sleep(5000); } }