Factored out some common test code for Web Sockets