Using a shutdown function rather than a destructor to terminate the test server