'As a debugging aid, a protocol system should raise a
L{ProtocolSwitched} exception when asked to switch a protocol that is
already switched.'

def test_doubleProtocolSwitch(self):

    serverDeferred = defer.Deferred()
    serverProto = SimpleSymmetricCommandProtocol(serverDeferred)
    clientDeferred = defer.Deferred()
    clientProto = SimpleSymmetricCommandProtocol(clientDeferred)
    (c, s, p) = connectedServerAndClient(ServerClass=(lambda : serverProto), ClientClass=(lambda : clientProto))
    def switched(result):
        self.assertRaises(amp.ProtocolSwitched, c.switchToTestProtocol)
        self.testSucceeded = True
    c.switchToTestProtocol().addCallback(switched)
    p.flush()
    self.assertTrue(self.testSucceeded)
