rest-driver/rest-driver — pull request #123 by joelittlejohn (2012-08-16 09:56:15+00:00)
Title: Add support for matching of concurrent requests

This patch synchronizes the request matching steps to allow rest-client-driver to support requests that arrive concurrently.

There are still some shared fields for which access is not synchronized, e.g. `DefaultClientDriverJettyHandler#unexpectedRequest`, but on the whole I think these can be considered safe in the way that they are used (who cares which concurrent request is unexpected, right?).

I've done a reasonable amount of exploratory testing with this and all matching errors I observed were caused by unsynchronized access to:

`DefaultClientDriverJettyHandler#matchedResponses`

and

`DefaultClientDriverJettyHandler#expectations`

This patch ensures that no two threads will ever update these collections concurrently.