github/bertrpc — pull request #3 by vmg (2014-09-29 14:42:58+00:00)
Title: Fix timeouts on reads

Explanation of the bug is https://github.com/github/github/issues/33514#issuecomment-57164523

We're using `Timeout#timeout` now for handling, but note we've changed the logic to something more reasonable: If we have `n` seconds to timeout for our RPC call, we don't wrap the `read` call with that timeout, we read the *two* read calls (the first one that returns the 4-byte header, and the one that returns the (potentially large) chunk of data).

I believe this is more accurate logic for what we want (i.e. we don't want our RPC call to take more than N seconds).

In order to test this, **I've mocked at the `IO#read` level with a sleep call**, to make sure that the Timeout block is working. The previous blocks were actually mocking `IO#read` to *throw a timeout exception*, which is not a particularly useful mock

cc @charliesome @dbussink