mitmproxy/test/test_websockets.py

16 lines
500 B
Python
Raw Normal View History

2015-04-10 02:35:40 +00:00
from netlib import test
from netlib.websockets import implementations as ws
class TestWebSockets(test.ServerTestBase):
handler = ws.WebSocketsEchoHandler
def test_websockets_echo(self):
msg = "hello I'm the client"
client = ws.WebSocketsClient(("127.0.0.1", self.port))
client.connect()
client.send_message(msg)
response = client.read_next_message()
print "Assert response: " + response + " == msg: " + msg
assert response == msg