'A deferred from the Proxy can be cancelled, disconnecting
the L{twisted.internet.interfaces.IConnector}.'

def test_cancel(self):

    def factory(*args, **kw):
        factory.f = TestQueryFactoryCancel(*args, **kw)
        return factory.f
    d = self.proxy(factory).callRemote('add', 2, 3)
    self.assertNotEqual(factory.f.connector.state, 'disconnected')
    d.cancel()
    self.assertEqual(factory.f.connector.state, 'disconnected')
    d = self.assertFailure(d, defer.CancelledError)
    return d
