'Test if IPv6 headers result in the correct host and peer data.'

def test_validIPv6HeaderResolves_getPeerHost(self):

    factory = HAProxyWrappingFactory(Factory.forProtocol(StaticProtocol))
    proto = factory.buildProtocol(address.IPv6Address('TCP', '::1', 8080))
    transport = StringTransportWithDisconnection()
    proto.makeConnection(transport)
    proto.dataReceived('PROXY    TCP6    ::1    ::2    8080    8888\r\n')
    self.assertEqual(proto.getPeer().host, '::1')
    self.assertEqual(proto.getPeer().port, 8080)
    self.assertEqual(proto.wrappedProtocol.transport.getPeer().host, '::1')
    self.assertEqual(proto.wrappedProtocol.transport.getPeer().port, 8080)
    self.assertEqual(proto.getHost().host, '::2')
    self.assertEqual(proto.getHost().port, 8888)
    self.assertEqual(proto.wrappedProtocol.transport.getHost().host, '::2')
    self.assertEqual(proto.wrappedProtocol.transport.getHost().port, 8888)
