79835429

Date: 2025-12-02 02:39:51
Score: 1
Natty:
Report link
// Source - https://stackoverflow.com/q/67360263
// Posted by hamid
// Retrieved 2025-12-01, License - CC BY-SA 4.0

object ServiceBuilder {
    private val client = OkHttpClient.Builder()
        .connectionSpecs(listOf(ConnectionSpec.MODERN_TLS) )
        .build()

    private val retrofit = Retrofit.Builder()
        .baseUrl(Config().BASE_URL)# "https://10.0.2.2:5000"
        .addConverterFactory(GsonConverterFactory.create())
        .client(client)
        .build()

    fun<T> buildService(service: Class<T>): T{
        Security.insertProviderAt(Conscrypt.newProvider(), 1);
        return retrofit.create(service)
    }
}
Reasons:
  • Blacklisted phrase (1): stackoverflow
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Eh Pa