def _testServerAddress(self, interface, addressFamily, adressClass):
        """
        Helper method to test TCP server addresses on either IPv4 or IPv6.
        """

        def connected(protocols):
            client, server, port = protocols
            try:
                self.assertEqual(
                    "<AccumulatingProtocol #%s on %s>" %
                        (server.transport.sessionno, port.getHost().port),
                    str(server.transport))

                self.assertEqual(
                    "AccumulatingProtocol,%s,%s" %
                        (server.transport.sessionno, interface),
                    server.transport.logstr)

                [peerAddress] = server.factory.peerAddresses
                self.assertIsInstance(peerAddress, adressClass)
                self.assertEqual('TCP', peerAddress.type)
                self.assertEqual(interface, peerAddress.host)
            finally:
                # Be certain to drop the connection so the test completes.
                server.transport.loseConnection()

        reactor = self.buildReactor()
        d = self.getConnectedClientAndServer(reactor, interface, addressFamily)
        d.addCallback(connected)
        d.addErrback(log.err)
        self.runReactor(reactor)

        Helper method to test TCP server addresses on either IPv4 or IPv6.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_tcp.py