Support for requests timeouts & cancelation, and improved tests

Change-Id: I1da175a88fc69cb6ac1c03b583163f16929a9936