示例#1
0
 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())
示例#2
0
 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())
示例#3
0
 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'))
示例#4
0
 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()))
示例#5
0
 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())