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


Python proto_helpers.FakeDatagramTransport方法代码示例

本文整理汇总了Python中twisted.test.proto_helpers.FakeDatagramTransport方法的典型用法代码示例。如果您正苦于以下问题:Python proto_helpers.FakeDatagramTransport方法的具体用法?Python proto_helpers.FakeDatagramTransport怎么用?Python proto_helpers.FakeDatagramTransport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twisted.test.proto_helpers的用法示例。


在下文中一共展示了proto_helpers.FakeDatagramTransport方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: loopix_mixes

# 需要导入模块: from twisted.test import proto_helpers [as 别名]
# 或者: from twisted.test.proto_helpers import FakeDatagramTransport [as 别名]
def loopix_mixes():
    sec_params = SphinxParams(header_len=1024)

    dbManager.create_mixnodes_table('Mixnodes')
    mixes = []
    pubs_mixes = []
    for i in range(3):
        mix = LoopixMixNode(sec_params, 'Mix%d'%(i+1), 9999-i, '1.2.3.%d'%i, i)
        mix.transport = proto_helpers.FakeDatagramTransport()
        mix.config_params = mix.config_params._replace(DATABASE_NAME = 'test.db')
        mixes.append(mix)
        dbManager.insert_row_into_table('Mixnodes',
                [None, mix.name, mix.port, mix.host,
                sqlite3.Binary(petlib.pack.encode(mix.pubk)), mix.group])
    pubs_mixes = [Mix(m.name, m.port, m.host, m.pubk, m.group) for m in mixes]
    return mixes, pubs_mixes 
开发者ID:UCL-InfoSec,项目名称:loopix,代码行数:18,代码来源:test_all.py

示例2: loopix_providers

# 需要导入模块: from twisted.test import proto_helpers [as 别名]
# 或者: from twisted.test.proto_helpers import FakeDatagramTransport [as 别名]
def loopix_providers():
    sec_params = SphinxParams(header_len=1024)

    dbManager.create_providers_table('Providers')
    providers = []
    pubs_providers = []
    for i in range(3):
        p = LoopixProvider(sec_params, 'Provider%d'%(i+1), 9995-i, '1.2.%d.4'%i)
        p.transport = proto_helpers.FakeDatagramTransport()
        p.config_params = p.config_params._replace(DATABASE_NAME = 'test.db')
        providers.append(p)
        dbManager.insert_row_into_table('Providers',
            [None, p.name, p.port, p.host,
            sqlite3.Binary(petlib.pack.encode(p.pubk))])
    pubs_providers = [Provider(p.name, p.port, p.host, p.pubk) for p in providers]
    return providers, pubs_providers 
开发者ID:UCL-InfoSec,项目名称:loopix,代码行数:18,代码来源:test_all.py

示例3: loopix_clients

# 需要导入模块: from twisted.test import proto_helpers [as 别名]
# 或者: from twisted.test.proto_helpers import FakeDatagramTransport [as 别名]
def loopix_clients(pubs_providers, pubs_mixes):

    sec_params = SphinxParams(header_len=1024)

    dbManager.create_users_table('Users')
    clients = []
    pubs_clients = []
    for i in range(3):
        provider = pubs_providers[i]
        c = LoopixClient(sec_params, 'Client%d'%(i+1), 9993 - i, '1.%d.3.4'%i, provider.name)
        c.register_mixes(pubs_mixes)
        c.transport = proto_helpers.FakeDatagramTransport()
        c.config_params = c.config_params._replace(DATABASE_NAME = 'test.db')
        c.provider = dbManager.select_provider_by_name(provider.name)
        clients.append(c)
        dbManager.insert_row_into_table('Users',
            [None, c.name, c.port, c.host,
            sqlite3.Binary(petlib.pack.encode(c.pubk)),
            c.provider.name])
    pubs_clients = [User(c.name, c.port, c.host, c.pubk, c.provider) for c in clients]
    return clients, pubs_clients 
开发者ID:UCL-InfoSec,项目名称:loopix,代码行数:23,代码来源:test_all.py

示例4: setUp

# 需要导入模块: from twisted.test import proto_helpers [as 别名]
# 或者: from twisted.test.proto_helpers import FakeDatagramTransport [as 别名]
def setUp(self):
        self.proxy = sip.RegisterProxy(host="intarweb.us")
        self.proxy.authorizers = self.proxy.authorizers.copy()
        self.proxy.authorizers['digest'] = FakeDigestAuthorizer()

        self.registry = FakeRegistry("intarweb.us")
        self.proxy.registry = self.proxy.locator = self.registry
        self.transport = proto_helpers.FakeDatagramTransport()
        self.proxy.transport = self.transport

        r = TestRealm()
        p = cred.portal.Portal(r)
        c = cred.checkers.InMemoryUsernamePasswordDatabaseDontUse()
        c.addUser('exarkun@intarweb.us', 'password')
        p.registerChecker(c)
        self.proxy.portal = p 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:18,代码来源:test_sip.py

示例5: setUp

# 需要导入模块: from twisted.test import proto_helpers [as 别名]
# 或者: from twisted.test.proto_helpers import FakeDatagramTransport [as 别名]
def setUp(self):
        """
        Create a L{dns.DNSDatagramProtocol} with a deterministic clock.
        """
        self.clock = task.Clock()
        self.controller = TestController()
        self.proto = dns.DNSDatagramProtocol(self.controller)
        transport = proto_helpers.FakeDatagramTransport()
        self.proto.makeConnection(transport)
        self.proto.callLater = self.clock.callLater 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:12,代码来源:test_dns.py

示例6: setUp

# 需要导入模块: from twisted.test import proto_helpers [as 别名]
# 或者: from twisted.test.proto_helpers import FakeDatagramTransport [as 别名]
def setUp(self):
        self.proxy = sip.RegisterProxy(host="intarweb.us")
        self.proxy.authorizers = self.proxy.authorizers.copy()
        self.proxy.authorizers['digest'] = FakeDigestAuthorizer()
        self.registry = FakeRegistry("intarweb.us")
        self.proxy.registry = self.proxy.locator = self.registry
        self.transport = proto_helpers.FakeDatagramTransport()
        self.proxy.transport = self.transport

        r = TestRealm()
        p = cred.portal.Portal(r)
        c = cred.checkers.InMemoryUsernamePasswordDatabaseDontUse()
        c.addUser('exarkun@intarweb.us', 'password')
        p.registerChecker(c)
        self.proxy.portal = p 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:17,代码来源:test_sip.py


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