Implementation of the ICache interface. We never actually cache anything here since it is all about mock responses, not actually caching real data.
Implementation of the ICache interface. Hijacks all requests to return a pre-populated response or "server disconnected".
Convenience method to populate simple responses. For more complex work, use one of the other overloads where you build complete objects yourself.
The client is about to make the given request. It will ALWAYS pass it to the cache object first so you can decide if you want to and can provide a response. You should probably check the appropriate headers to see if you should even attempt to look up on the cache (HttpClient does NOT do this to give maximum flexibility to the cache implementor).
The given request has received the given response. The implementing class needs to decide if it wants to cache or not. Return true if it was added, false if you chose not to.
A pseudo-cache to provide a mock server. Construct one of these, populate it with test responses, and pass it to HttpClient to do a network-free test.
You should populate it with the populate method. Any request not pre-populated will return a "server refused connection" response.