本文整理汇总了Python中seecr.test.portnumbergenerator.PortNumberGenerator.unbind方法的典型用法代码示例。如果您正苦于以下问题:Python PortNumberGenerator.unbind方法的具体用法?Python PortNumberGenerator.unbind怎么用?Python PortNumberGenerator.unbind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类seecr.test.portnumbergenerator.PortNumberGenerator
的用法示例。
在下文中一共展示了PortNumberGenerator.unbind方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testBindPortRangeNumberGiven
# 需要导入模块: from seecr.test.portnumbergenerator import PortNumberGenerator [as 别名]
# 或者: from seecr.test.portnumbergenerator.PortNumberGenerator import unbind [as 别名]
def testBindPortRangeNumberGiven(self):
port = PortNumberGenerator.next(blockSize=2)
port2 = port + 1
PortNumberGenerator.bind(port=port, blockSize=2)
self.assertNotBound(bindV4(ip='127.0.0.1', port=port, protocol='tcp', reuse=True))
self.assertNotBound(bindV4(ip='127.0.0.1', port=port2, protocol='tcp', reuse=True))
PortNumberGenerator.unbind(port=port, blockSize=2)
self.assertBoundAndUnbind(bindV4(ip='127.0.0.1', port=port, protocol='tcp', reuse=True))
self.assertBoundAndUnbind(bindV4(ip='127.0.0.1', port=port2, protocol='tcp', reuse=True))
示例2: testUnbindPortNumberV4
# 需要导入模块: from seecr.test.portnumbergenerator import PortNumberGenerator [as 别名]
# 或者: from seecr.test.portnumbergenerator.PortNumberGenerator import unbind [as 别名]
def testUnbindPortNumberV4(self):
p = PortNumberGenerator.next(bind=True)
self.assertNotBound(bindV4(ip='127.0.0.1', port=p, protocol='tcp', reuse=True))
PortNumberGenerator.unbind(port=p)
self.assertBoundAndUnbind(bindV4(ip='127.0.0.1', port=p, protocol='tcp', reuse=False))
self.assertBoundAndUnbind(bindV4(ip='127.0.0.1', port=p, protocol='tcp', reuse=False)) # Same IP-version, protocol, host, port combination: basically testing bindV4's close happened.
self.assertBoundAndUnbind(bindV4(ip='127.0.0.1', port=p, protocol='udp', reuse=False))
self.assertBoundAndUnbind(bindV4(ip='0.0.0.0', port=p, protocol='tcp', reuse=False))
self.assertBoundAndUnbind(bindV4(ip='0.0.0.0', port=p, protocol='udp', reuse=False))
示例3: testBindPortNumberGiven
# 需要导入模块: from seecr.test.portnumbergenerator import PortNumberGenerator [as 别名]
# 或者: from seecr.test.portnumbergenerator.PortNumberGenerator import unbind [as 别名]
def testBindPortNumberGiven(self):
port, close = attemptBinding(bindPort=0); close()
PortNumberGenerator.bind(port=port)
self.assertNotBound(bindV4(ip='127.0.0.1', port=port, protocol='tcp', reuse=True))
if has_dual_stack():
self.assertNotBound(bindV6(ip='::1', port=port, protocol='tcp', reuse=True))
PortNumberGenerator.unbind(port=port)
self.assertBoundAndUnbind(bindV4(ip='127.0.0.1', port=port, protocol='tcp', reuse=True))
if has_dual_stack():
self.assertBoundAndUnbind(bindV6(ip='::1', port=port, protocol='tcp', reuse=True))
示例4: testUnbindPortNumberV6
# 需要导入模块: from seecr.test.portnumbergenerator import PortNumberGenerator [as 别名]
# 或者: from seecr.test.portnumbergenerator.PortNumberGenerator import unbind [as 别名]
def testUnbindPortNumberV6(self):
if not has_dual_stack():
return printDualStackSkipped()
p = PortNumberGenerator.next(bind=True)
self.assertNotBound(bindV4(ip='::1', port=p, protocol='tcp', reuse=True))
PortNumberGenerator.unbind(port=p)
self.assertBoundAndUnbind(bindV6(ip='::1', port=p, protocol='tcp', reuse=False)) # Same IP-version, protocol, host, port combination: basically testing bindV6's close happened.
for protocol in ['tcp', 'udp']:
self.assertBoundAndUnbind(bindV4(ip='127.0.0.1', port=p, protocol=protocol, reuse=False))
self.assertBoundAndUnbind(bindV4(ip='0.0.0.0', port=p, protocol=protocol, reuse=False))
self.assertBoundAndUnbind(bindV6(ip='::1', port=p, protocol=protocol, reuse=False))
self.assertBoundAndUnbind(bindV6(ip='::', port=p, protocol=protocol, reuse=False))
self.assertBoundAndUnbind(bindV6(ip='::1', port=p, protocol=protocol, reuse=False, ipV6Only=False))
self.assertBoundAndUnbind(bindV6(ip='::', port=p, protocol=protocol, reuse=False, ipV6Only=False))
示例5: testUnbindUnboundPortNumber
# 需要导入模块: from seecr.test.portnumbergenerator import PortNumberGenerator [as 别名]
# 或者: from seecr.test.portnumbergenerator.PortNumberGenerator import unbind [as 别名]
def testUnbindUnboundPortNumber(self):
PortNumberGenerator.unbind(port=4321)