how to use fbFlipper flipper interceptor with HTTPURLConnection

89 views Asked by At

having code uses HttpURLConnectionfor post the remote service.

    HttpURLConnection connection = null;
    final int CLIENT_SESSION_TTL = 300000; 
    try {
        connection = mUrl.openConnection();
        connection.setDoOutput(true);
        connection.setRequestMethod("POST");
        connection.setRequestProperty("Content-Type", "application/json");
        connection.setRequestProperty("Accept-Encoding", "gzip");
        for (final Map.Entry<String, String> entry : mHeaders.entrySet()) {
            connection.setRequestProperty(entry.getKey(), entry.getValue());
        }
        connection.setConnectTimeout(CLIENT_SESSION_TTL);
        final String postBody = getPostBody(messages);

        final OutputStream out = new BufferedOutputStream(connection.getOutputStream());
        out.write(postBody.getBytes());
        out.flush();
        out.close();
        final int responseCode = connection.getResponseCode();  

How to set a Flipper interceptor to the HttpURLConnection, or is it possible?

0

There are 0 answers