'A L{H2Stream} object correctly passes through host and peer information
from its L{H2Connection}.'

def test_passthroughHostAndPeer(self):

    hostAddress = IPv4Address('TCP', '17.52.24.8', 443)
    peerAddress = IPv4Address('TCP', '17.188.0.12', 32008)
    frameFactory = FrameFactory()
    transport = StringTransport(hostAddress=hostAddress, peerAddress=peerAddress)
    connection = H2Connection()
    connection.requestFactory = DummyHTTPHandlerProxy
    connection.makeConnection(transport)
    frames = buildRequestFrames(self.getRequestHeaders, [], frameFactory)
    requestBytes = frameFactory.clientConnectionPreface()
    requestBytes += ''.join((frame.serialize() for frame in frames))
    for byte in iterbytes(requestBytes):
        connection.dataReceived(byte)
    stream = connection.streams[1]
    self.assertEqual(stream.getHost(), hostAddress)
    self.assertEqual(stream.getPeer(), peerAddress)
    cleanupCallback = connection._streamCleanupCallbacks[1]
    def validate(*args):
        self.assertEqual(stream.getHost(), hostAddress)
        self.assertEqual(stream.getPeer(), peerAddress)
    return cleanupCallback.addCallback(validate)
