java.net.SocketTimeoutException: timeout

前端 未结 6 917
余生分开走
余生分开走 2021-02-03 18:27

With OkHttp library, application is facing following SocketTimeoutException issue. If request size is less, then it is working fine(Less than 1MB). I a

6条回答
  •  面向向阳花
    2021-02-03 18:40

    Use this for Kotlin

     val client1 = OkHttpClient.Builder()
                    .connectTimeout(2, TimeUnit.MINUTES)
                    .writeTimeout(2, TimeUnit.MINUTES) // write timeout
                    .readTimeout(2, TimeUnit.MINUTES) // read timeout
                    .addInterceptor(
                        BasicAuthInterceptor(
                            AmvaccAppConstants.AUTHENTICATE_USER_NAME, AmvaccAppConstants.AUTHENTICATE_USER_PASSWORD
                        )
                    )
                    .addInterceptor(interceptor)
                    .build()
    

提交回复
热议问题