NightscoutFoundation / xDrip

Nightscout version of xDrip+
https://jamorham.github.io/#xdrip-plus
GNU General Public License v3.0
1.39k stars 1.14k forks source link

migrate OkHttp2 to OkHttp3 #1812

Open tolot27 opened 3 years ago

tolot27 commented 3 years ago

Some classes still using com.squareup.okhttp (v2.x) which is deprecated since 2016. Many others using the newer v3.x. Using both major versions within a project can cause strange problems like https://github.com/square/okhttp/issues/2705. We should migrate the code using the deprecated version to v3.

tolot27 commented 4 months ago

The best practice in OkHttp 3 is to create a single OkHttpClient instance and share it throughout the application. Requests that needs a customized client should call OkHttpClient.newBuilder() on that shared instance. This allows customization without the drawbacks of separate connection pools.