'Check that C{reason} is a L{Failure} wrapping a L{ConnectionDone}
instance and stop the reactor.  If C{reason} is wrong for some reason,
log something about that in C{self.errorLogFile} and make sure the
process exits with a non-zero status.'

def connectionLost(self, reason):

    try:
        reason.trap(ConnectionDone)
    except:
        log.err(None, 'Problem    with    reason    passed    to    connectionLost')
        self.exitCode = 1
    finally:
        reactor.stop()
