[Test] Wrap server start to automatically close the socket