'When a query issued by L{client.Resolver.query} times out, the retry
uses a new protocol instance.'

def test_differentProtocolAfterTimeout(self):

    resolver = client.Resolver(servers=[('example.com', 53)])
    protocols = []
    results = [defer.fail(failure.Failure(DNSQueryTimeoutError(None))), defer.succeed(dns.Message())]
    class FakeProtocol(object, ):
        def __init__(self):
            self.transport = StubPort()
        def query(self, address, query, timeout=10, id=None):
            protocols.append(self)
            return results.pop(0)
    resolver._connectedProtocol = FakeProtocol
    resolver.query(dns.Query('foo.example.com'))
    self.assertEqual(len(set(protocols)), 2)
