def test_streamListen(self): samEndpoint = FakeEndpoint() session = SAMSession() session.nickname = 'foo' session.samEndpoint = samEndpoint session.samVersion = '3.1' session.id = 'foo' session._autoClose = True endpoint = endpoints.SAMI2PStreamServerEndpoint(session) endpoint.listen(None) self.assertSubstring('HELLO VERSION', samEndpoint.transport.value())
def test_streamConnect(self): samEndpoint = FakeEndpoint() session = SAMSession() session.nickname = 'foo' session.samEndpoint = samEndpoint session.samVersion = '3.1' session.id = 'foo' session._autoClose = True endpoint = endpoints.SAMI2PStreamClientEndpoint(session, 'foo.i2p') endpoint.connect(None) self.assertSubstring('HELLO VERSION', samEndpoint.transport.value())
def test_streamConnect(self): samEndpoint = FakeEndpoint() session = SAMSession() session.nickname = 'foo' session.samEndpoint = samEndpoint session.samVersion = '3.1' session.id = 'foo' session._autoClose = True endpoint = endpoints.SAMI2PStreamClientEndpoint(session, 'foo.i2p') endpoint.connect(None) self.assertSubstring('HELLO VERSION', samEndpoint.transport.value().decode('utf-8'))
def test_streamListen(self): samEndpoint = FakeEndpoint() session = SAMSession() session.nickname = 'foo' session.samEndpoint = samEndpoint session.samVersion = '3.1' session.id = 'foo' session._autoClose = True endpoint = endpoints.SAMI2PStreamServerEndpoint(session) endpoint.listen(None) self.assertSubstring('HELLO VERSION', str(samEndpoint.transport.value()))
def test_streamConnect(self): reactor = proto_helpers.MemoryReactor() samEndpoint = FakeEndpoint() session = SAMSession() session.nickname = 'foo' session.samEndpoint = samEndpoint session.samVersion = '3.1' session.id = 'foo' session._autoClose = True endpoint = endpoints.SAMI2PStreamServerEndpoint(reactor, session, '') endpoint.listen(None) self.assertSubstring('HELLO VERSION', samEndpoint.transport.value())