Thread.sleep(SLEEP_DEFAULT);
}
@Test
public void testStartExceptionCleanup() throws InterruptedException {
final ServerService server = new ServerService(serverConfiguration, processorTaskFactory);
boolean gotException = false;
// start in 1st thread
new Thread(new Runnable() {
@Override
public void run() {
server.call();
}
}).start();
sleep();
// start in 2nd thread
try {
server.call();
} catch (IllegalStateException e) {
gotException = true;
}
assertTrue(gotException);// should throw an exception
server.cancel();
assertTrue(server.isStopped());
}