I want to post some json string to some URL. I am getting Exception as
Exception: java.net.SocketTimeoutException: failed to connect to
searched lot regarding this issue people are suggesting to increase and decrease timeout parameters in retrofit. I want to know difference between writeTimeout, readTimeout and connectTimeout. So that i can trigger SocketTimeoutException. here my retro client.
public static Retrofit getClient() {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient.Builder().writeTimeout(20, TimeUnit.SECONDS).
//.authenticator(new Authen()).
readTimeout(30, TimeUnit.SECONDS).
connectTimeout(20, TimeUnit.SECONDS).
addInterceptor(interceptor).build();
return new Retrofit.Builder()
.baseUrl(DefinesClass.ITS_URL)
// .baseUrl("https://reqres.in")
// .addConverterFactory(GsonConverterFactory.create())
.addConverterFactory(SimpleXmlConverterFactory.create())
.client(client)
.build();
}
Is there any way i can sort that exception help guys?