Simple mock of WebSocket API for use in unit tests.