I have an android app that home screen make few requests to server(5-10 requests by enqueue() depend on app logic) but when i come with adding one more request, i cannot get response from log. I config retrofit following code:
HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() {
@Override
public void log(String message) {
Log.d(TAG, message);
}
});
httpLoggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
httpBuilder.addInterceptor(httpLoggingInterceptor);
ConnectionSpec spec = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS)
.tlsVersions(TlsVersion.TLS_1_2)
.cipherSuites(
CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
CipherSuite.TLS_DHE_RSA_WITH_AES_128_GCM_SHA256)
.build();
httpBuilder
.readTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS)
.connectTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS)
.writeTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS);
httpBuilder.connectionSpecs(Collections.singletonList(spec));
and i call request by:
Call<ResponseBody> call = getCallRequest();
call.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable t) {
// process failure case
}
});
but HttpLoggingInterceptor do not log response of this request as <-- logging.... It's not occur in all requests, sometime ok so i think the reason is connection pool but i try the code by adding the line:
httpBuilder.connectionPool(new ConnectionPool(10, 5L, TimeUnit.MINUTES));
but its not effected. Please help me find out the way to resolve this. Many thanks!