'L{client.Resolver.query} only issues one request at a time per query.
Subsequent requests made before responses to prior ones are received
are queued and given the same response as is given to the first one.'

def test_singleConcurrentRequest(self):

    protocol = StubDNSDatagramProtocol()
    resolver = client.Resolver(servers=[('example.com', 53)])
    resolver._connectedProtocol = (lambda : protocol)
    queries = protocol.queries
    query = dns.Query('foo.example.com', dns.A, dns.IN)
    firstResult = resolver.query(query)
    self.assertEqual(len(queries), 1)
    secondResult = resolver.query(query)
    self.assertEqual(len(queries), 1)
    answer = object()
    response = dns.Message()
    response.answers.append(answer)
    queries.pop()[(-1)].callback(response)
    d = defer.gatherResults([firstResult, secondResult])
    def cbFinished(responses):
        (firstResponse, secondResponse) = responses
        self.assertEqual(firstResponse, ([answer], [], []))
        self.assertEqual(secondResponse, ([answer], [], []))
    d.addCallback(cbFinished)
    return d
