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
For Retrofit retrofit:2.0.0-beta4 the code goes as follows:
OkHttpClient client = new OkHttpClient.Builder()
.addInterceptor(logging)
.connectTimeout(30, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.writeTimeout(30, TimeUnit.SECONDS)
.build();
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("http://api.yourapp.com/")
.addConverterFactory(GsonConverterFactory.create())
.client(client)
.build();