Fix : Slow server response. #616
I added a global OkHttpClient with long timeouts and initialized AndroidNetworking with it. I replaced per-request new OkHttpClient() usages with the shared client to avoid overriding the longer timeouts. I aligned the Rx sample apps to initialize with the same client.
Updated app/src/main/java/com/networking/MyApplication.java to build an OkHttpClient with 120s connect/read/write timeouts and pass it to AndroidNetworking.initialize(...). Exposed getOkHttpClient() to reuse.
Updated per-request overrides in app:
- app/src/main/java/com/networking/ApiTestActivity.java (2 spots) to use MyApplication.getInstance().getOkHttpClient().
- app/src/main/java/com/networking/OkHttpResponseTestActivity.java (2 spots) to use the same shared client. Updated Rx sample apps to use the same approach:
- rxsampleapp/src/main/java/com/rxsampleapp/RxMyApplication.java
- rx2sampleapp/src/main/java/com/rx2sampleapp/Rx2MyApplication.java
Contribution by Gittensor, learn more at https://gittensor.io/
This ensures slow server responses (50β60s) wonβt trigger premature onError due to client-side timeouts.
Please check PR. Thanks.