'When the protocol is switched, it should notify its nested client
protocol factory of disconnection.'

def test_protocolSwitchLoseClientConnection(self):

    class ClientLoser:
        reason = None
        def clientConnectionLost(self, connector, reason):
            self.reason = reason
    a = amp.BinaryBoxProtocol(self)
    connectionLoser = protocol.Protocol()
    clientLoser = ClientLoser()
    a.makeConnection(self)
    a._lockForSwitch()
    a._switchTo(connectionLoser, clientLoser)
    connectionFailure = Failure(RuntimeError())
    a.connectionLost(connectionFailure)
    self.assertEqual(clientLoser.reason, connectionFailure)
