These answers were outdated for me, so here's how it worked out.
Add OkHttp, in my case the version is 3.3.1
:
compile 'com.squareup.okhttp3:okhttp:3.3.1'
Then before building your Retrofit, do this:
OkHttpClient okHttpClient = new OkHttpClient().newBuilder()
.connectTimeout(60, TimeUnit.SECONDS)
.readTimeout(60, TimeUnit.SECONDS)
.writeTimeout(60, TimeUnit.SECONDS)
.build();
return new Retrofit.Builder()
.baseUrl(baseUrl)
.client(okHttpClient)
.addConverterFactory(GsonConverterFactory.create())
.build();