def returnConnected(server, client):
    """Take two Protocol instances and connect them.
    """
    cio = BytesIO()
    sio = BytesIO()
    client.makeConnection(FileWrapper(cio))
    server.makeConnection(FileWrapper(sio))
    pump = IOPump(client, server, cio, sio)
    # Challenge-response authentication:
    pump.flush()
    # Uh...
    pump.flush()
    return pump
Take two Protocol instances and connect them.
    
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/testutils.py