I am trying to test HTTP timeout scripts using MockWebServer, which responds to my test requests sent using Retrofit / OkHttp. (This question was asked a few years ago, but at the time it was related to an error in MockWebServer. In addition, the API has since changed the fair bit, so I think the retransmission of this question is justified.)
It seems that there are several related methods, but I would appreciate a solution to this problem with a clear example: I am not sure about the difference between the two.
.delayBody and.throttleBody
In addition, both of these methods seem to only delay / throttle the body - is it possible to set a timeout for the response header? That is, something like the lines "wait X seconds after the next incoming request before sending any response."
source
share