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


Python Context.queue方法代码示例

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


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

示例1: runTest

# 需要导入模块: from context import Context [as 别名]
# 或者: from context.Context import queue [as 别名]
	def runTest( self ):

		context = Context( 'context' )
		context.start()

		listener = UacSubscriptionListener()
		listener.context = context

		subscription = UacSubscription( 'subscription0', listener, subscriptionSource='', user='chloe', resourceUri=Uri('bones', 'cave'), event='whats-to-eat', contentType=ContentType('food', 'xml'), expires=3600 )

		context.queue( Event( subscription.EVENT_SUBSCRIBE ), subscription )

		s = 'SIP/2.0 100 Trying\r\nTo: "Matt"<sip:[email protected]>\r\nContact: "RileyMan"<sip:[email protected]>\r\nFrom: "Josh"<sip:[email protected]>\r\nCall-ID: abcd\r\n\r\n'
		m = Message( s )
		e = MessageEvent( MessageEvent.EVENT_RX, message=m, transport='udp', localAddress='127.0.0.1', localPort=9000, remoteAddress='127.0.0.1', remotePort=9001 )
		context.queue( e, subscription )

		s = 'SIP/2.0 200 OK\r\nTo: "Matt"<sip:[email protected]>\r\nContact: "RileyMan"<sip:[email protected]>\r\nFrom: "Josh"<sip:[email protected]>\r\nCall-ID: abcd\r\n\r\n'
		m = Message( s )
		e = MessageEvent( MessageEvent.EVENT_RX, message=m, transport='udp', localAddress='127.0.0.1', localPort=9000, remoteAddress='127.0.0.1', remotePort=9001 )
		context.queue( e, subscription )

		context.queue( Event( subscription.EVENT_UNSUBSCRIBE ), subscription )

		s = 'SIP/2.0 200 OK\r\nTo: "Matt"<sip:[email protected]>\r\nContact: "RileyMan"<sip:[email protected]>\r\nFrom: "Josh"<sip:[email protected]>\r\nCall-ID: abcd\r\n\r\n'
		m = Message( s )
		e = MessageEvent( MessageEvent.EVENT_RX, message=m, transport='udp', localAddress='127.0.0.1', localPort=9000, remoteAddress='127.0.0.1', remotePort=9001 )
		context.queue( e, subscription )

		sleep( 0.5 )

		assert 1
开发者ID:CaveMike,项目名称:mercury,代码行数:34,代码来源:subscription_test.py

示例2: runTest

# 需要导入模块: from context import Context [as 别名]
# 或者: from context.Context import queue [as 别名]
	def runTest( self ):

		context = Context( 'context' )
		context.start()

		listener = TestListener()
		listener.context = context

		node = System( 'system0', listener )
		node.addListener( listener )

		node.process( Event( 'Start' ) )

		s = 'SUBSCRIBE sip:[email protected];treats SIP/2.0\r\nTo: "Matt"<sip:[email protected]>\r\nFrom: "Josh"<sip:[email protected]>\r\nContact: "RileyMan"<sip:[email protected]>\r\nCall-ID: 12345\r\nCSeq: 16 SUBSCRIBE\r\n\r\n'
		m = Message( s )
		e = MessageEvent( MessageEvent.EVENT_RX, message=m, transport='udp', localAddress=node.query( 'network.localAddress' ), localPort=node.query( 'network.localPort' ), remoteAddress=node.query( 'network.remoteAddress' ), remotePort=node.query( 'network.remotePort' ) )
		context.queue( e, node )
		sleep( 2 )
开发者ID:CaveMike,项目名称:mercury,代码行数:20,代码来源:system_test.py

示例3: test

# 需要导入模块: from context import Context [as 别名]
# 或者: from context.Context import queue [as 别名]
    def test(self):
        events = [Event('event0'), Event('event1'), Event('event2')]

        o = SampleObj(events)

        c = Context('context0')

        for event in events:
            future = c.queue(event, o, o)
        time.sleep(0.1)

        c.poll()
开发者ID:CaveMike,项目名称:iron,代码行数:14,代码来源:test_context.py


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