Example #1
0
 def setUp(self):
     context = Context()
     server = makeTCPServer(context, ServerProtocol)
     client = yield makeTCPClient(context, EchoClient, server)
     hook(EchoClient, 'lineReceived')
     self.client = client.clientProtocol
     self.server = client.serverProtocol
     self.addCleanup(context.cleanup)
Example #2
0
 def setUp(self):
     context = Context()
     server = makeTCPServer(context, MyServerProtocol,
                            WebSocketServerFactory())
     client = yield makeWebSocketClient(context, server)
     hook(WebSocketClientProtocol,
          'onMessage',
          decoder=lambda payload, _: payload)
     self.client = client.clientProtocol
     self.addCleanup(context.cleanup)
 def setUp(self):
     context = Context()
     server = makeTCPServer(context, WebSocketServerProtocol,
                            WebSocketServerFactory())
     hook(WebSocketServerProtocol,
          'onMessage',
          decoder=lambda payload, _: payload)
     client = yield makeWebSocketClient(context, server, MyClientProtocol)
     self.server = client.serverProtocol
     # cancel the loop:
     self.addCleanup(context.cleanup, delayedCalls=1)
Example #4
0
 def setUp(self):
     context = Context()
     self.factory = ChatFactory()
     server = makeTCPServer(context,
                            Chat,
                            self.factory,
                            installProtocol=False)
     self.client1 = (yield makeTCPClient(context, ClientProtocol,
                                         server)).clientProtocol
     self.client2 = (yield makeTCPClient(context, ClientProtocol,
                                         server)).clientProtocol
     self.addCleanup(context.cleanup)
Example #5
0
 def setUp(self):
     context = self.context = Context()
     self.dir = TempDirectory()
     self.addCleanup(self.dir.cleanup)
     # make sure that we trap unexpected close messages:
     hook(ServerProtocol, 'sendClose')
     self.server = makeTCPServer(context,
                                 ServerProtocol,
                                 buildSite(b'gotit', self.dir.path),
                                 installProtocol=False)
     client = yield makeWebSocketClient(context,
                                        self.server,
                                        factoryClass=ServerTesterFactory,
                                        close='close',
                                        endpoint='/spam')
     self.client = client.clientProtocol
     self.addCleanup(context.cleanup, threads=True, delayedCalls=1)
 def setUp(self):
     context = Context()
     server = makeTCPServer(context, EchoServer)
     client = yield makeTCPClient(context, ClientProtocol, server)
     self.client = client.clientProtocol
     self.addCleanup(context.cleanup)
 def testNoClient(self):
     context = Context()
     makeTCPServer(context, EchoServer)
     yield context.cleanup()
 def testConnectDisconnect(self):
     context = Context()
     server = makeTCPServer(context, EchoServer)
     client = yield makeTCPClient(context, ClientProtocol, server)
     self.client = client.clientProtocol
     yield context.cleanup()