Beispiel #1
0
 def test_client_close_connection(self):
     c = Client()
     yield c.connect()
     connection = c._Client__connection
     socket = connection._Connection__socket
     socket.close()
     res = yield c.call("PING")
     self.assertTrue(isinstance(res, ConnectionError))
     self.assertFalse(c.is_connected())
     c.disconnect()
Beispiel #2
0
 def test_client_close_connection(self):
     c = Client()
     yield c.connect()
     connection = c._Client__connection
     socket = connection._Connection__socket
     socket.close()
     res = yield c.call("PING")
     self.assertTrue(isinstance(res, ConnectionError))
     self.assertFalse(c.is_connected())
     c.disconnect()
Beispiel #3
0
 def test_server_close_connection(self):
     c = Client()
     c2 = Client()
     yield c.connect()
     yield c2.connect()
     future1 = c.call('BLPOP', 'test_server_close_connection', 0)
     future2 = self._close_connection(c2)
     res = yield [future1, future2]
     self.assertTrue(isinstance(res[0], ConnectionError))
     self.assertFalse(c.is_connected())
     yield c.connect()
     res2 = yield c.call("PING")
     self.assertEqual(res2, b"PONG")
     c.disconnect()
     c2.disconnect()
Beispiel #4
0
 def test_server_close_connection(self):
     c = Client()
     c2 = Client()
     yield c.connect()
     yield c2.connect()
     future1 = c.call('BLPOP', 'test_server_close_connection', 0)
     future2 = self._close_connection(c2)
     res = yield [future1, future2]
     self.assertTrue(isinstance(res[0], ConnectionError))
     self.assertFalse(c.is_connected())
     yield c.connect()
     res2 = yield c.call("PING")
     self.assertEqual(res2, b"PONG")
     c.disconnect()
     c2.disconnect()