Is it possible to throttle bandwidth when using OkHttp?
问题 Is it possible when using OkHttp to throttle the bandwidth? (possibly using a network interceptor). 回答1: You can make it work in two ways: Send request and read stream manually, and throttle while reading there. Add an Interceptor. Using OkHttp the best way is Interceptor. There are also a few simple steps: To inherit the Interceptor interface. To inherit the ResponseBody class. In custom ResponceBody override fun source(): BufferedSource needs to return the BandwidthSource's buffer. Example