

def loopbackAsync(server, client, pumpPolicy=identityPumpPolicy):
    "\n    Establish a connection between C{server} and C{client} then transfer data\n    between them until the connection is closed. This is often useful for\n    testing a protocol.\n\n    @param server: The protocol instance representing the server-side of this\n        connection.\n\n    @param client: The protocol instance representing the client-side of this\n        connection.\n\n    @param pumpPolicy: When either C{server} or C{client} writes to its\n        transport, the string passed in is added to a queue of data for the\n        other protocol.  Eventually, C{pumpPolicy} will be called with one such\n        queue and the corresponding protocol object.  The pump policy callable\n        is responsible for emptying the queue and passing the strings it\n        contains to the given protocol's C{dataReceived} method.  The signature\n        of C{pumpPolicy} is C{(queue, protocol)}.  C{queue} is an object with a\n        C{get} method which will return the next string written to the\n        transport, or C{None} if the transport has been disconnected, and which\n        evaluates to C{True} if and only if there are more items to be\n        retrieved via C{get}.\n\n    @return: A L{Deferred} which fires when the connection has been closed and\n        both sides have received notification of this.\n    "
    serverToClient = _LoopbackQueue()
    clientToServer = _LoopbackQueue()
    server.makeConnection(_LoopbackTransport(serverToClient))
    client.makeConnection(_LoopbackTransport(clientToServer))
    return _loopbackAsyncBody(clientToServer, serverToClient, client, clientToServer, pumpPolicy)

dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/protocols/loopback.py loopbackAsync/VarMisuse@53/574 `server`->`clientToServer`