Make MAX_RETRIES accessible to test code

https://github.com/couchbase/couchbase-lite-android/issues/398
Clean up logging

https://github.com/couchbase/couchbase-lite-android/issues/398
I noticed that it was only retrying once, rather than twice as on current master branch.

https://github.com/couchbase/couchbase-lite-android/issues/398
Minor logging improvements

https://github.com/couchbase/couchbase-lite-android/issues/398
Move request retry logic to separate class

Plus associated refactoring

https://github.com/couchbase/couchbase-lite-android/issues/398
modify replicationinternal to use new retry logic for json requests

https://github.com/couchbase/couchbase-lite-android/issues/398