Refactor test of websocket examples.