'Called when TLS connection has gone away; tell underlying transport to
disconnect.
@param reason: a L{Failure} whose value is an L{Exception} if we want to
report that failure through to the wrapped protocol\'s
C{connectionLost}, or L{None} if the C{reason} that
C{connectionLost} should receive should be coming from the
underlying transport.
@type reason: L{Failure} or L{None}'

def _tlsShutdownFinished(self, reason):

    if (reason is not None):
        if (tuple(reason.value.args[:2]) == ((-1), 'Unexpected    EOF')):
            reason = Failure(CONNECTION_LOST)
    if (self._reason is None):
        self._reason = reason
    self._lostTLSConnection = True
    self._flushSendBIO()
    self.transport.loseConnection()
