Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StethoURLConnectionManager usage #461

Closed
arvi opened this issue Nov 30, 2016 · 2 comments
Closed

StethoURLConnectionManager usage #461

arvi opened this issue Nov 30, 2016 · 2 comments

Comments

@arvi
Copy link

arvi commented Nov 30, 2016

Hello, I'm trying to make network interceptor work for urlconnection and according to docu:

If you are using HttpURLConnection, you can use StethoURLConnectionManager

Do you have any example doing so? I can't find any articles about it.

Here is my VolleySingleton snippet where I'd like to add it:

    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) {
            mRequestQueue = Volley.newRequestQueue(mCtx.getApplicationContext(), hurlStack);
        }
        return mRequestQueue;
    }

My build.gradle

    compile 'com.facebook.stetho:stetho:1.4.1'
    compile 'com.facebook.stetho:stetho-urlconnection:1.4.1'
@longinoa
Copy link
Contributor

longinoa commented Dec 2, 2016

You can look at the sample app to see how we have integrated with StethoURLConnectionManager.
Using volley with HttpURLConnection will not work as you need to discretely handle the state machine in StethoURLConnectionManager.

Volley should work with OkHttp which has documentation in various places See (#51 (comment))

@longinoa longinoa closed this as completed Dec 2, 2016
@arvi
Copy link
Author

arvi commented Dec 7, 2016

@longinoa thanks for the tip, i'll check it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants