More options for shouldRetry

Allow shouldTry to be a boolean, number, or function to determine
whether or not we should retry the request.

Refactor unit tests to use synchronous requests.  Since we're mocking
the endpoints, this results in the tests running much faster and it's
easier to understand when a test is considered done.