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

def test_protocolSwitchLoseConnection(self):

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