'If a L{TLSMemoryBIOProtocol} loses its connection unexpectedly, this is
reported to the application.'

def test_disorderlyShutdown(self):

    clientConnectionLost = Deferred()
    clientFactory = ClientFactory()
    clientFactory.protocol = (lambda : ConnectionLostNotifyingProtocol(clientConnectionLost))
    clientContextFactory = HandshakeCallbackContextFactory()
    wrapperFactory = TLSMemoryBIOFactory(clientContextFactory, True, clientFactory)
    sslClientProtocol = wrapperFactory.buildProtocol(None)
    serverProtocol = Protocol()
    loopbackAsync(serverProtocol, sslClientProtocol)
    serverProtocol.transport.loseConnection()
    def cbDisconnected(clientProtocol):
        clientProtocol.lostConnectionReason.trap(Error, ConnectionLost)
    clientConnectionLost.addCallback(cbDisconnected)
    return clientConnectionLost
