-
Notifications
You must be signed in to change notification settings - Fork 285
Closed
Description
Hi! I'm doing some tests for my websocket server using ws4py client and sometimes get this error:
Exception in thread WebSocketClient:
Traceback (most recent call last):
File "C:\Python27\lib\threading.py", line 810, in __bootstrap_inner
self.run()
File "C:\Python27\lib\threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "C:\Python27\lib\site-packages\ws4py\websocket.py", line 427, in run
if not self.once():
File "C:\Python27\lib\site-packages\ws4py\websocket.py", line 305, in once
if not self.process(b):
File "C:\Python27\lib\site-packages\ws4py\websocket.py", line 362, in process
self.close(s.closing.code, s.closing.reason)
File "C:\Python27\lib\site-packages\ws4py\client\__init__.py", line 198, in close
self._write(self.stream.close(code=code, reason=reason).single(mask=True))
File "C:\Python27\lib\site-packages\ws4py\websocket.py", line 243, in _write
self.sock.sendall(b)
File "C:\Python27\lib\socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
error: [Errno 10053] ��������� �� ����� ����-
Here is test code:
from httplib import HTTPConnection
from sys import maxint
from unittest import TestCase
from ws4py.client.threadedclient import WebSocketClient
import config
from protocol.test_pb2 import Empty
from protocol.packets_pb2 import Client
from protocol.client_pb2 import Login
class TestClient(WebSocketClient):
def __init__(self, path, data):
super(TestClient, self).__init__('ws://%s:%u%s' % (config.LISTEN_IP, config.LISTEN_PORT, path))
self.__connected = None
self.__message = None
self.connect()
self.send(data, True)
self.run_forever()
@property
def connected(self):
return self.__connected
@property
def message(self):
return self.__message
def opened(self):
self.__connected = True
def closed(self, code, reason = None):
self.__connected = False
def received_message(self, message):
self.__message = message
class TestProtocol(TestCase):
def __test(self, data, path = '/'):
socket = TestClient(path, data)
self.assertEqual(socket.connected, False)
self.assertIs(socket.message, None)
def test_incorrect_path(self):
packet = Client()
packet.type = Client.LOGIN
packet.login.id = 0
packet.login.type = Login.TEST
packet.login.version = 1
self.__test(packet.SerializeToString(), '/test')
def test_empty_packet(self):
packet = Empty()
self.__test(packet.SerializeToString())
def test_incorrect_packet(self):
self.__test('This is not Protocol Buffers message!')
def test_unhandled_packet(self):
packet = Client()
packet.type = maxint
self.__test(packet.SerializeToString())I tried to use gevent based client and got the same error, but less often.
Metadata
Metadata
Assignees
Labels
No labels