0

I have a small trouble with okhttp.

  1. How to set a connect time (for ex. 10 sec and this 10 sec okhttp lib should try to get a response from server)?

  2. How to set a connect tries (for ex. when this 10 sec is ended)?

Pang
  • 9,564
  • 146
  • 81
  • 122
Artiom
  • 47
  • 1
  • 10

1 Answers1

0
        client = new OkHttpClient();
        client.setConnectTimeout(10, TimeUnit.SECONDS);
        client.setReadTimeout(10, TimeUnit.SECONDS);
        client.setWriteTimeout(10, TimeUnit.SECONDS);