test(socket): refactor the mock WebSocket