connectTimeout in okhttp3 slows down responnse time

Ho All, I have a odd issue with okhttp version 4.9.0. It seems to increase the response time ( client.newCall(request).execute() ). If I increase the connectTimeout to 5 seconds the response time increases to 6 if I increase it to 15 seconds the response time increases to 16 seconds. Below is how I am using the builder.

 client = new OkHttpClient.Builder()
                .connectionPool(new ConnectionPool(2, 2, TimeUnit.SECONDS))
                .connectTimeout(2, TimeUnit.SECONDS)
                .readTimeout(25, TimeUnit.SECONDS).build();

Thanks for any hints!

Read more here:

Content Attribution

This content was originally published by Tony Anecito at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: