def oneTransportTest(testMethod):
    """
    Decorate a L{ReactorBuilder} test function which tests one reactor and one
    connected transport.  Run that test method in the context of
    C{connectionMade}, and immediately drop the connection (and end the test)
    when that completes.

    @param testMethod: A unit test method on a L{ReactorBuilder} test suite;
        taking two additional parameters; a C{reactor} as built by the
        L{ReactorBuilder}, and an L{ITCPTransport} provider.
    @type testMethod: 3-argument C{function}

    @return: a no-argument test method.
    @rtype: 1-argument C{function}
    """
    @wraps(testMethod)
    def actualTestMethod(builder):
        other = ConnectableProtocol()
        class ServerProtocol(ConnectableProtocol):
            def connectionMade(self):
                try:
                    testMethod(builder, self.reactor, self.transport)
                finally:
                    if self.transport is not None:
                        self.transport.loseConnection()
                    if other.transport is not None:
                        other.transport.loseConnection()
        serverProtocol = ServerProtocol()
        runProtocolsWithReactor(builder, serverProtocol, other, TCPCreator())
    return actualTestMethod

    Decorate a L{ReactorBuilder} test function which tests one reactor and one
    connected transport.  Run that test method in the context of
    C{connectionMade}, and immediately drop the connection (and end the test)
    when that completes.

    @param testMethod: A unit test method on a L{ReactorBuilder} test suite;
        taking two additional parameters; a C{reactor} as built by the
        L{ReactorBuilder}, and an L{ITCPTransport} provider.
    @type testMethod: 3-argument C{function}

    @return: a no-argument test method.
    @rtype: 1-argument C{function}
    
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_tcp.py