I've got this:
final OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url(someUrl)
.build();
Response response = client.newCall(request).execute();
I have looked at https://github.com/square/okhttp/wiki/Recipes#timeouts
I tried adding:
.connectTimeout(10, TimeUnit.SECONDS)
.writeTimeout(10, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
To the OkHttpClient
builder, but I did not notice any difference even when I set the timeout number to 1 second.
Is there some way to listen for a timeout? What should I expect to happen if that timeout value is exceeded?