So I recently learned about Stetho and would like to implement it to intercept network requests. However, I cannot find an example on how to do it for URLConnection:
Here is a snippet of my VolleySingleton class.
private RequestQueue getRequestQueue() {
HurlStack hurlStack = new HurlStack() {
@Override
protected HttpURLConnection createConnection(URL url) throws IOException {
HttpsURLConnection httpsURLConnection = (HttpsURLConnection) super.createConnection(url);
try {
httpsURLConnection.setSSLSocketFactory(getSSLSocketFactory());
httpsURLConnection.setHostnameVerifier(getHostnameVerifier());
} catch (Exception e) {
e.printStackTrace();
}
return httpsURLConnection;
}
};
if(mRequestQueue == null) {
// this will make sure that this particular instance will last the lifetime of the app
// getApplicationContext() is key, it keeps you from leaking the Activity or BroadcastReceiver if someone passes one in.
mRequestQueue = Volley.newRequestQueue(mCtx.getApplicationContext(), hurlStack);
}
return mRequestQueue;
}
According to the docu: If you are using HttpURLConnection, you can use StethoURLConnectionManager
But I cannot figure out how to do it after checking the class. Maybe someone has experience on this issue? Thanks a lot.