It turned out that what I actually worked for, however, due to the asynchronous nature of server.stop() , my new server was trying to create an instance before the previous thread of the completed server ended.
The simple Thread.sleep(n) after server.stop() gives the server the time it takes to close between tests. Unfortunately, the server, apparently, prematurely claims that it stopped, thereby preventing an exact solution by checking the status of the server - but perhaps there is something to interrogate on the server; perhaps studying a thread pool can provide a consistent result?
In any case, since this is only for testing purposes, just starting the server in @BeforeClass and closing it in @AfterClass prevents the cedar from shutting down completely, but beware then starting another server on the same port in your test package.
source share