当前位置: 首页>>代码示例>>Python>>正文


Python PortNumberGenerator.unbind方法代码示例

本文整理汇总了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))
开发者ID:seecr,项目名称:seecr-test,代码行数:12,代码来源:portnumbergeneratortest.py

示例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))
开发者ID:seecr,项目名称:seecr-test,代码行数:12,代码来源:portnumbergeneratortest.py

示例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))
开发者ID:seecr,项目名称:seecr-test,代码行数:13,代码来源:portnumbergeneratortest.py

示例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))
开发者ID:seecr,项目名称:seecr-test,代码行数:19,代码来源:portnumbergeneratortest.py

示例5: testUnbindUnboundPortNumber

# 需要导入模块: from seecr.test.portnumbergenerator import PortNumberGenerator [as 别名]
# 或者: from seecr.test.portnumbergenerator.PortNumberGenerator import unbind [as 别名]
 def testUnbindUnboundPortNumber(self):
     PortNumberGenerator.unbind(port=4321)
开发者ID:seecr,项目名称:seecr-test,代码行数:4,代码来源:portnumbergeneratortest.py


注:本文中的seecr.test.portnumbergenerator.PortNumberGenerator.unbind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。