2

I am using retrofit in my android app, while i'm calling the api first time the api work fine but after some time (10-15 minutes) in same page it will give java.net.SocketTimeoutException: timed out or some time java.net.SocketTimeoutException: SSL handshake timed out. While in postman the request work fine.

OkHttpClient okHttpClient = new OkHttpClient().newBuilder()
                    .connectTimeout(60, TimeUnit.SECONDS)
                    .readTimeout(60, TimeUnit.SECONDS)
                    .writeTimeout(60, TimeUnit.SECONDS)
                    .build();

            retrofit = new Retrofit.Builder()
                    .baseUrl(BuildConfig.BASE_URL)
                    .client(okHttpClient)
                    .addConverterFactory(GsonConverterFactory.create())
                    .build();

0 Answers0