I am developing app using OkHttp library and my trouble is I cannot find how to set connection timeout and socket timeout.
OkHttpClient client = new OkHttpCl
If you want to customize the configuration then use the below methodology of creating OKhttpclient first and then add builder on top of it.
private final OkHttpClient client = new OkHttpClient();
// Copy to customize OkHttp for this request.
OkHttpClient client1 = client.newBuilder()
.readTimeout(500, TimeUnit.MILLISECONDS)
.build();
try (Response response = client1.newCall(request).execute()) {
System.out.println("Response 1 succeeded: " + response);
} catch (IOException e) {
System.out.println("Response 1 failed: " + e);
}