Make the test server thread a template, and move it to a shared header