1 # -*- test-case-name: twisted.test.test_stdio.StandardInputOutputTestCase.test_hostAndPeer -*-
2 # Copyright (c) Twisted Matrix Laboratories.
3 # See LICENSE for details.
6 Main program for the child process run by
7 L{twisted.test.test_stdio.StandardInputOutputTestCase.test_hostAndPeer} to test
8 that ITransport.getHost() and ITransport.getPeer() work for process transports.
13 from twisted.internet import stdio, protocol
14 from twisted.python import reflect
16 class HostPeerChild(protocol.Protocol):
17 def connectionMade(self):
18 self.transport.write('\n'.join([
19 str(self.transport.getHost()),
20 str(self.transport.getPeer())]))
21 self.transport.loseConnection()
24 def connectionLost(self, reason):
28 if __name__ == '__main__':
29 reflect.namedAny(sys.argv[1]).install()
30 from twisted.internet import reactor
31 stdio.StandardIO(HostPeerChild())