Exemple #1
0
 def test_remote_close_during_call(self):
     chan, rchan = make_channel_pair()
     conn = Connection(chan)
     Connection(rchan).close()
     with self.assertRaisesRegex(DisconnectError,
                                 'Connection was remotely closed'):
         conn.call(nop)
     conn.close()
Exemple #2
0
 def test_communication_error_during_call(self):
     chan = ConnectionChannel()
     conn = Connection(chan)
     try:
         with self.assertRaisesRegex(DisconnectError,
                                     'Connection was aborted due to .*'):
             conn.call(Box(chan.cancel)
                       )  # simulate communication error with channel.cancel
         with self.assertRaisesRegex(DisconnectError,
                                     'Connection was aborted due to .*'):
             conn.call(nop)
     finally:
         try:
             conn.close()
         except Exception:
             pass