mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
16 lines
500 B
Python
16 lines
500 B
Python
|
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
|
||
|
|