def test_conn_socket_upgrade(self): c = AsyncConn("127.0.0.1", 4150, io_loop=self.io_loop, **self.identify_options) c.on("ready", self.stop) c.connect() self.wait() assert isinstance(c.socket, DeflateSocket) assert isinstance(c.socket._socket, ssl.SSLSocket)
def test_conn_messages(self): self.msg_count = 0 topic = 'test_conn_suscribe_%s' % time.time() self._send_messages(topic, 5, 'sup') c = AsyncConn('127.0.0.1', 4150, io_loop=self.io_loop, **self.identify_options) def _on_message(*args, **kwargs): self.msg_count += 1 if c.rdy == 0: self.stop() def _on_ready(*args, **kwargs): c.on('message', _on_message) c.send(protocol.subscribe(topic, 'ch')) c.send_rdy(5) c.on('ready', _on_ready) c.connect() self.wait() assert self.msg_count == 5
def test_conn_identify(self): c = AsyncConn('127.0.0.1', 4150, io_loop=self.io_loop) c.on('identify_response', self.stop) c.connect() response = self.wait() print response assert response['conn'] is c assert isinstance(response['data'], dict)
def test_conn_identify(self): c = AsyncConn("127.0.0.1", 4150, io_loop=self.io_loop) c.on("identify_response", self.stop) c.connect() response = self.wait() print(response) assert response["conn"] is c assert isinstance(response["data"], dict)
def test_conn_socket_upgrade(self): c = AsyncConn('127.0.0.1', 4150, io_loop=self.io_loop, **self.identify_options) c.on('ready', self.stop) c.connect() self.wait() assert isinstance(c.socket, DeflateSocket) assert isinstance(c.socket._socket, ssl.SSLSocket)
def test_conn_socket_upgrade(self): c = AsyncConn('127.0.0.1', 4150, io_loop=self.io_loop, **self.identify_options) c.on('ready', self.stop) c.connect() self.wait() assert isinstance(c.socket, SnappySocket) assert isinstance(c.socket._socket, ssl.SSLSocket)
def _send_messages(self, topic, count, body): c = AsyncConn('127.0.0.1', 4150, io_loop=self.io_loop) c.connect() def _on_ready(*args, **kwargs): for i in range(count): c.send(protocol.pub(topic, body)) c.on('ready', _on_ready)
def test_conn_identify_options(self): c = AsyncConn("127.0.0.1", 4150, io_loop=self.io_loop, **self.identify_options) c.on("identify_response", self.stop) c.connect() response = self.wait() print(response) assert response["conn"] is c assert isinstance(response["data"], dict) assert response["data"]["snappy"] is True assert response["data"]["tls_v1"] is True
def test_conn_identify_options(self): c = AsyncConn('127.0.0.1', 4150, io_loop=self.io_loop, **self.identify_options) c.on('identify_response', self.stop) c.connect() response = self.wait() print response assert response['conn'] is c assert isinstance(response['data'], dict) assert response['data']['snappy'] is True assert response['data']['tls_v1'] is True
def test_conn_identify_options(self): c = AsyncConn('127.0.0.1', 4150, io_loop=self.io_loop, **self.identify_options) c.on('identify_response', self.stop) c.connect() response = self.wait() print(response) assert response['conn'] is c assert isinstance(response['data'], dict) assert response['data']['deflate'] is True assert response['data']['tls_v1'] is True
def test_conn_subscribe(self): topic = "test_conn_suscribe_%s" % time.time() c = AsyncConn("127.0.0.1", 4150, io_loop=self.io_loop, **self.identify_options) def _on_ready(*args, **kwargs): c.on("response", self.stop) c.send(protocol.subscribe(topic, "ch")) c.on("ready", _on_ready) c.connect() response = self.wait() print(response) assert response["conn"] is c assert response["data"] == b"OK"
def test_conn_subscribe(self): topic = 'test_conn_suscribe_%s' % time.time() c = AsyncConn('127.0.0.1', 4150, io_loop=self.io_loop, **self.identify_options) def _on_ready(*args, **kwargs): c.on('response', self.stop) c.send(protocol.subscribe(topic, 'ch')) c.on('ready', _on_ready) c.connect() response = self.wait() print response assert response['conn'] is c assert response['data'] == 'OK'
def test_conn_subscribe(self): topic = 'test_conn_suscribe_%s' % time.time() c = AsyncConn('127.0.0.1', 4150, io_loop=self.io_loop, **self.identify_options) def _on_ready(*args, **kwargs): c.on('response', self.stop) c.send(protocol.subscribe(topic, 'ch')) c.on('ready', _on_ready) c.connect() response = self.wait() print(response) assert response['conn'] is c assert response['data'] == b'OK'
def test_conn_messages(self): self.msg_count = 0 topic = "test_conn_suscribe_%s" % time.time() self._send_messages(topic, 5, b"sup") c = AsyncConn("127.0.0.1", 4150, io_loop=self.io_loop, **self.identify_options) def _on_message(*args, **kwargs): self.msg_count += 1 if c.rdy == 0: self.stop() def _on_ready(*args, **kwargs): c.on("message", _on_message) c.send(protocol.subscribe(topic, "ch")) c.send_rdy(5) c.on("ready", _on_ready) c.connect() self.wait() assert self.msg_count == 5