Upstream proxy support and unit test extensions.

A minor change to make using an upstream proxy simpler, and a bunch of unit test changes.  Mostly new tests, and a hook to allow override of the API URL so we can test internally.