Add default timeout to MockWebServer.takeRequest()
MockWebServer.takeRequest() without parameters will block indefinitely if there is no request coming. In my opinion this is a bit unfortunate, because in case of e.g. a bug in our code which results in no calls being made, the complete test suite stalls. Another use case is when writing test-first code, then there is often no request yet programmed, yet I cannot run the test to assert that it is failing.
The solution is to use the overloaded method with an explicit timeout. But this makes the code less readable, and there are potentially many repetitions of the MockWebServer.takeRequest(xxx, SECONDS) (and similar) calls, which are basically noise.
This is why I want to suggest a feature to be able to set a default timeout, either per MockWebServer instance, or globally. Many test libraries like Awaitility or Mockito use static global variables for some baseline settings.
There is a good opportunity with OkHttp 5 to look at this now.