3132333435363738394041
final ServerService server = new ServerService(serverConfiguration, processorTaskFactory); new Thread(new Runnable() { @Override public void run() { server.call(); } }).start(); sleep(); server.cancel();
5556575859606162636465
// start in 1st thread new Thread(new Runnable() { @Override public void run() { server.call(); } }).start(); sleep(); // start in 2nd thread
6263646566676869707172
} }).start(); sleep(); // start in 2nd thread try { server.call(); } catch (IllegalStateException e) { gotException = true; } assertTrue(gotException);// should throw an exception