本文整理匯總了Python中recorder.Recorder.getSocketPair方法的典型用法代碼示例。如果您正苦於以下問題:Python Recorder.getSocketPair方法的具體用法?Python Recorder.getSocketPair怎麽用?Python Recorder.getSocketPair使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類recorder.Recorder
的用法示例。
在下文中一共展示了Recorder.getSocketPair方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_SocketPair2
# 需要導入模塊: from recorder import Recorder [as 別名]
# 或者: from recorder.Recorder import getSocketPair [as 別名]
def test_SocketPair2(self):
rec = Recorder()
rec.createSocketPair(1,2)
self.assertTrue(rec.isForwardSocket(2))
self.assertFalse(rec.isForwardSocket(1))
self.assertEqual(rec.getSocketPair(2),1)
self.assertEqual(rec.getSocketPair(1),2)
rec.createSocketPair(3,4)
self.assertTrue(rec.isForwardSocket(4))
self.assertFalse(rec.isForwardSocket(3))
self.assertEqual(rec.getSocketPair(4),3)
self.assertEqual(rec.getSocketPair(3),4)
示例2: test_SocketPairClose
# 需要導入模塊: from recorder import Recorder [as 別名]
# 或者: from recorder.Recorder import getSocketPair [as 別名]
def test_SocketPairClose(self):
rec = Recorder()
rec.createSocketPair(1,2)
self.assertTrue(rec.isForwardSocket(2))
self.assertFalse(rec.isForwardSocket(1))
self.assertEqual(rec.getSocketPair(2),1)
self.assertEqual(rec.getSocketPair(1),2)
self.assertEqual(rec.socketCount(),2)
rec.closeSocket(1)
with self.assertRaises(Exception) as context:
self.assertTrue(rec.isForwardSocket(2))
self.assertEqual(rec.socketCount(),0)