Changed the way the server stops. This seems to have fixed the test isolation issue as it stops the wait loop on the thread.