def test_validIPv4HeaderResolves_getPeerHost(self):
        """
        Test if IPv4 headers result in the correct host and peer data.
        """
        factory = HAProxyWrappingFactory(Factory.forProtocol(StaticProtocol))
        proto = factory.buildProtocol(
            address.IPv4Address('TCP', b'127.0.0.1', 8080),
        )
        transport = StringTransportWithDisconnection()
        proto.makeConnection(transport)
        proto.dataReceived(b'PROXY TCP4 1.1.1.1 2.2.2.2 8080 8888\r\n')
        self.assertEqual(proto.getPeer().host, b'1.1.1.1')
        self.assertEqual(proto.getPeer().port, 8080)
        self.assertEqual(
            proto.wrappedProtocol.transport.getPeer().host,
            b'1.1.1.1',
        )
        self.assertEqual(
            proto.wrappedProtocol.transport.getPeer().port,
            8080,
        )
        self.assertEqual(proto.getHost().host, b'2.2.2.2')
        self.assertEqual(proto.getHost().port, 8888)
        self.assertEqual(
            proto.wrappedProtocol.transport.getHost().host,
            b'2.2.2.2',
        )
        self.assertEqual(
            proto.wrappedProtocol.transport.getHost().port,
            8888,
        )

        Test if IPv4 headers result in the correct host and peer data.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/haproxy/test/test_wrapper.py