本文整理汇总了Python中proton.reactor.Reactor.connection方法的典型用法代码示例。如果您正苦于以下问题:Python Reactor.connection方法的具体用法?Python Reactor.connection怎么用?Python Reactor.connection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类proton.reactor.Reactor
的用法示例。
在下文中一共展示了Reactor.connection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ExceptionTest
# 需要导入模块: from proton.reactor import Reactor [as 别名]
# 或者: from proton.reactor.Reactor import connection [as 别名]
class ExceptionTest(Test):
def setup(self):
self.reactor = Reactor()
def test_reactor_final(self):
self.reactor.global_handler = BarfOnFinal()
try:
self.reactor.run()
assert False, "expected to barf"
except Barf:
pass
def test_global_set(self):
self.reactor.global_handler = BarfOnInit()
try:
self.reactor.run()
assert False, "expected to barf"
except Barf:
pass
def test_global_add(self):
self.reactor.global_handler.add(BarfOnInit())
try:
self.reactor.run()
assert False, "expected to barf"
except Barf:
pass
def test_reactor_set(self):
self.reactor.handler = BarfOnInit()
try:
self.reactor.run()
assert False, "expected to barf"
except Barf:
pass
def test_reactor_add(self):
self.reactor.handler.add(BarfOnInit())
try:
self.reactor.run()
assert False, "expected to barf"
except Barf:
pass
def test_connection(self):
self.reactor.connection(BarfOnInit())
try:
self.reactor.run()
assert False, "expected to barf"
except Barf:
pass
def test_connection_set(self):
c = self.reactor.connection()
c.handler = BarfOnInit()
try:
self.reactor.run()
assert False, "expected to barf"
except Barf:
pass
def test_connection_add(self):
c = self.reactor.connection()
c.handler = object()
c.handler.add(BarfOnInit())
try:
self.reactor.run()
assert False, "expected to barf"
except Barf:
pass
def test_session_set(self):
c = self.reactor.connection()
s = c.session()
s.handler = BarfOnInit()
try:
self.reactor.run()
assert False, "expected to barf"
except Barf:
pass
def test_session_add(self):
c = self.reactor.connection()
s = c.session()
s.handler = object()
s.handler.add(BarfOnInit())
try:
self.reactor.run()
assert False, "expected to barf"
except Barf:
pass
def test_link_set(self):
c = self.reactor.connection()
s = c.session()
l = s.sender("xxx")
l.handler = BarfOnInit()
try:
self.reactor.run()
assert False, "expected to barf"
#.........这里部分代码省略.........
示例2: ExceptionTest
# 需要导入模块: from proton.reactor import Reactor [as 别名]
# 或者: from proton.reactor.Reactor import connection [as 别名]
class ExceptionTest(Test):
def setup(self):
self.reactor = Reactor()
def test_reactor_final(self):
self.reactor.global_handler = BarfOnFinal()
try:
self.reactor.run()
assert False, "expected to barf"
except Barf:
pass
def test_global_set(self):
self.reactor.global_handler = BarfOnInit()
try:
self.reactor.run()
assert False, "expected to barf"
except Barf:
pass
def test_global_add(self):
self.reactor.global_handler.add(BarfOnInit())
try:
self.reactor.run()
assert False, "expected to barf"
except Barf:
pass
def test_reactor_set(self):
self.reactor.handler = BarfOnInit()
try:
self.reactor.run()
assert False, "expected to barf"
except Barf:
pass
def test_reactor_add(self):
self.reactor.handler.add(BarfOnInit())
try:
self.reactor.run()
assert False, "expected to barf"
except Barf:
pass
def test_connection(self):
self.reactor.connection(BarfOnInit())
try:
self.reactor.run()
assert False, "expected to barf"
except Barf:
pass
def test_connection_set(self):
c = self.reactor.connection()
c.handler = BarfOnInit()
try:
self.reactor.run()
assert False, "expected to barf"
except Barf:
pass
def test_connection_add(self):
c = self.reactor.connection()
c.handler = object()
c.handler.add(BarfOnInit())
try:
self.reactor.run()
assert False, "expected to barf"
except Barf:
pass
def test_session_set(self):
c = self.reactor.connection()
s = c.session()
s.handler = BarfOnInit()
try:
self.reactor.run()
assert False, "expected to barf"
except Barf:
pass
def test_session_add(self):
c = self.reactor.connection()
s = c.session()
s.handler = object()
s.handler.add(BarfOnInit())
try:
self.reactor.run()
assert False, "expected to barf"
except Barf:
pass
def test_link_set(self):
c = self.reactor.connection()
s = c.session()
l = s.sender("xxx")
l.handler = BarfOnInit()
try:
self.reactor.run()
#.........这里部分代码省略.........