queue = servicetest.IteratingEventQueue(None) queue.verbose = (os.environ.get('CHECK_TWISTED_VERBOSE', '') != '' or '-v' in sys.argv) bus = dbus.SessionBus() params = { 'account': 'test1@localhost/Resource', 'password': '******', 'resource': 'Resource', 'server': 'localhost', 'port': dbus.UInt32(4242), } conn1, jid1 = make_connection(bus, queue.append, params) authenticator = BlockForeverTlsAuthenticator('test1', 'pass') stream1 = make_stream(queue.append, authenticator, protocol=XmppXmlStream) factory = twisted.internet.protocol.Factory() factory.protocol = lambda: stream1 port1 = reactor.listenTCP(4242, factory, interface='localhost') params = { 'account': 'test2@localhost/Resource', 'password': '******', 'resource': 'Resource', 'server': 'localhost', 'port': dbus.UInt32(4343), } conn2, jid2 = make_connection(bus, queue.append, params) authenticator = XmppAuthenticator('test2', 'pass') stream2 = make_stream(queue.append, authenticator, protocol=XmppXmlStream)
queue.verbose = ( os.environ.get('CHECK_TWISTED_VERBOSE', '') != '' or '-v' in sys.argv) bus = dbus.SessionBus() params = { 'account': 'test1@localhost/Resource', 'password': '******', 'resource': 'Resource', 'server': 'localhost', 'port': dbus.UInt32(4242), } conn1, jid1 = make_connection(bus, queue.append, params) authenticator = BlockForeverTlsAuthenticator('test1', 'pass') stream1 = make_stream(queue.append, authenticator, protocol=XmppXmlStream) factory = twisted.internet.protocol.Factory() factory.protocol = lambda:stream1 port1 = reactor.listenTCP(4242, factory, interface='localhost') params = { 'account': 'test2@localhost/Resource', 'password': '******', 'resource': 'Resource', 'server': 'localhost', 'port': dbus.UInt32(4343), } conn2, jid2 = make_connection(bus, queue.append, params) authenticator = XmppAuthenticator('test2', 'pass') stream2 = make_stream(queue.append, authenticator, protocol=XmppXmlStream)
os.environ.get('CHECK_TWISTED_VERBOSE', '') != '' or '-v' in sys.argv) bus = dbus.SessionBus() params = { 'account': 'test1@localhost/Resource', 'password': '******', 'resource': 'Resource', 'server': 'localhost', 'port': dbus.UInt32(4242), } conn1 = make_connection(bus, queue.append, params) authenticator = JabberAuthenticator('test1', 'pass', resource=params['resource']) stream1, port1 = make_stream(queue.append, authenticator, protocol=JabberXmlStream, port=4242) params = { 'account': 'test2@localhost/Resource', 'password': '******', 'resource': 'Resource', 'server': 'localhost', 'port': dbus.UInt32(4343), } conn2 = make_connection(bus, queue.append, params) authenticator = XmppAuthenticator('test2', 'pass', resource=params['resource']) stream2, port2 = make_stream(queue.append, authenticator, protocol=XmppXmlStream, port=4343) test(queue, bus, conn1, conn2, stream1, stream2)