def patch_transport_abortConnection(transport, protocol):
    """
    Patch abortConnection() onto the transport if it doesn't already have it.
    (`Agent` assumes its transport has this.)
    """
    def abortConnection():
        protocol._fake_connection_aborted = True
        transport.loseConnection()
    patch_if_missing(transport, 'abortConnection', abortConnection)