private static Thread startHTTPConnection(String p16, String p17, org.json.JSONObject p18, com.onesignal.OneSignalRestClient$ResponseHandler p19, int p20, String p21)
    {
        if (android.os.Build$VERSION.SDK_INT >= 26) {
            android.net.TrafficStats.setThreadStatsTag(10000);
        }
        String v7_1 = -1;
        try {
            String v9_1 = new StringBuilder();
            v9_1.append(OneSignalRestClient: Making request to: https://onesignal.com/api/v1/);
            v9_1.append(p16);
            com.onesignal.OneSignal.Log(com.onesignal.OneSignal$LOG_LEVEL.DEBUG, v9_1.toString());
            int v8_1 = com.onesignal.OneSignalRestClient.newHttpURLConnection(p16);
            try {
                v8_1.setUseCaches(0);
                v8_1.setConnectTimeout(p20);
                v8_1.setReadTimeout(p20);
                v8_1.setRequestProperty(SDK-Version, onesignal/android/031204);
            } catch (String v0_1) {
                try {
                    if ((v0_1 instanceof java.net.ConnectException)) {
                        String v3_22 = new StringBuilder();
                        v3_22.append(OneSignalRestClient: Could not send last request, device is offline. Throwable: );
                        v3_22.append(v0_1.getClass().getName());
                        com.onesignal.OneSignal.Log(com.onesignal.OneSignal$LOG_LEVEL.INFO, v3_22.toString());
                    } else {
                        if (!(v0_1 instanceof java.net.UnknownHostException)) {
                            String v4_9 = new StringBuilder();
                            v4_9.append(OneSignalRestClient: );
                            v4_9.append(p17);
                            v4_9.append( Error thrown from network stack. );
                            com.onesignal.OneSignal.Log(com.onesignal.OneSignal$LOG_LEVEL.WARN, v4_9.toString(), v0_1);
                        } else {
                        }
                    }
                } catch (String v0_19) {
                    if (v8_1 != 0) {
                        v8_1.disconnect();
                    }
                    throw v0_19;
                }
                String v0_10 = com.onesignal.OneSignalRestClient.callResponseHandlerOnFailure(p19, v7_1, 0, v0_1);
                if (v8_1 == 0) {
                    return v0_10;
                } else {
                    v8_1.disconnect();
                    return v0_10;
                }
                if (v8_1 == 0) {
                    return v0_10;
                } else {
                }
            }
            if (p18 != 0) {
                v8_1.setDoInput(1);
            }
            if (p17 != null) {
                v8_1.setRequestProperty(Content-Type, application/json; charset=UTF-8);
                v8_1.setRequestMethod(p17);
                v8_1.setDoOutput(1);
            }
            if (p18 != 0) {
                String v9_10 = p18.toString();
                String v11_1 = new StringBuilder();
                v11_1.append(OneSignalRestClient: );
                v11_1.append(p17);
                v11_1.append( SEND JSON: );
                v11_1.append(v9_10);
                com.onesignal.OneSignal.Log(com.onesignal.OneSignal$LOG_LEVEL.DEBUG, v11_1.toString());
                String v9_11 = v9_10.getBytes(UTF-8);
                v8_1.setFixedLengthStreamingMode(v9_11.length);
                v8_1.getOutputStream().write(v9_11);
            }
            if (p21 != null) {
                String v11_4 = new StringBuilder();
                v11_4.append(PREFS_OS_ETAG_PREFIX_);
                v11_4.append(p21);
                String v10_9 = com.onesignal.OneSignalPrefs.getString(com.onesignal.OneSignalPrefs.PREFS_ONESIGNAL, v11_4.toString(), 0);
                if (v10_9 != null) {
                    v8_1.setRequestProperty(if-none-match, v10_9);
                    String v12_3 = new StringBuilder();
                    v12_3.append(OneSignalRestClient: Adding header if-none-match: );
                    v12_3.append(v10_9);
                    com.onesignal.OneSignal.Log(com.onesignal.OneSignal$LOG_LEVEL.DEBUG, v12_3.toString());
                }
            }
            v7_1 = v8_1.getResponseCode();
            try {
                String v11_9 = new StringBuilder();
                v11_9.append(OneSignalRestClient: After con.getResponseCode to: https://onesignal.com/api/v1/);
                v11_9.append(p16);
                com.onesignal.OneSignal.Log(com.onesignal.OneSignal$LOG_LEVEL.VERBOSE, v11_9.toString());
                String v12_0 = ;
                int v13_0 = GET;
            } catch (String v0_1) {
            }
            if ((v7_1 == 200) || (v7_1 == 202)) {
                String v6_1 = new StringBuilder();
                int v18_1 = v7_1;
                try {
                    v6_1.append(OneSignalRestClient: Successfully finished request to: https://onesignal.com/api/v1/);
                    v6_1.append(p16);
                    com.onesignal.OneSignal.Log(com.onesignal.OneSignal$LOG_LEVEL.DEBUG, v6_1.toString());
                    String v6_4 = new java.util.Scanner(v8_1.getInputStream(), UTF-8);
                } catch (String v0_1) {
                    v7_1 = v18_1;
                }
                if (v6_4.useDelimiter(\A).hasNext()) {
                    v12_0 = v6_4.next();
                }
                v6_4.close();
                String v3_1 = new StringBuilder();
                v3_1.append(OneSignalRestClient: );
                if (p17 != null) {
                    v13_0 = p17;
                } else {
                }
                v3_1.append(v13_0);
                v3_1.append( RECEIVED JSON: );
                v3_1.append(v12_0);
                com.onesignal.OneSignal.Log(com.onesignal.OneSignal$LOG_LEVEL.DEBUG, v3_1.toString());
                if (p21 != null) {
                    String v0_8 = v8_1.getHeaderField(etag);
                    if (v0_8 != null) {
                        String v6_6 = new StringBuilder();
                        v6_6.append(OneSignalRestClient: Response has etag of );
                        v6_6.append(v0_8);
                        v6_6.append( so caching the response.);
                        com.onesignal.OneSignal.Log(com.onesignal.OneSignal$LOG_LEVEL.DEBUG, v6_6.toString());
                        String v6_9 = new StringBuilder();
                        v6_9.append(PREFS_OS_ETAG_PREFIX_);
                        v6_9.append(p21);
                        com.onesignal.OneSignalPrefs.saveString(com.onesignal.OneSignalPrefs.PREFS_ONESIGNAL, v6_9.toString(), v0_8);
                        String v3_6 = new StringBuilder();
                        v3_6.append(PREFS_OS_HTTP_CACHE_PREFIX_);
                        v3_6.append(p21);
                        com.onesignal.OneSignalPrefs.saveString(com.onesignal.OneSignalPrefs.PREFS_ONESIGNAL, v3_6.toString(), v12_0);
                    }
                }
                v0_10 = com.onesignal.OneSignalRestClient.callResponseHandlerOnSuccess(p19, v12_0);
            } else {
                if (v7_1 == 304) {
                    String v3_9 = new StringBuilder();
                    v3_9.append(PREFS_OS_HTTP_CACHE_PREFIX_);
                    v3_9.append(p21);
                    String v0_12 = com.onesignal.OneSignalPrefs.getString(com.onesignal.OneSignalPrefs.PREFS_ONESIGNAL, v3_9.toString(), 0);
                    String v4_1 = new StringBuilder();
                    v4_1.append(OneSignalRestClient: );
                    if (p17 != null) {
                        v13_0 = p17;
                    } else {
                    }
                    v4_1.append(v13_0);
                    v4_1.append( - Using Cached response due to 304: );
                    v4_1.append(v0_12);
                    com.onesignal.OneSignal.Log(com.onesignal.OneSignal$LOG_LEVEL.DEBUG, v4_1.toString());
                    v0_10 = com.onesignal.OneSignalRestClient.callResponseHandlerOnSuccess(p19, v0_12);
                } else {
                    String v9_6 = new StringBuilder();
                    v9_6.append(OneSignalRestClient: Failed request to: https://onesignal.com/api/v1/);
                    v9_6.append(p16);
                    com.onesignal.OneSignal.Log(com.onesignal.OneSignal$LOG_LEVEL.DEBUG, v9_6.toString());
                    String v0_14 = v8_1.getErrorStream();
                    if (v0_14 == null) {
                        v0_14 = v8_1.getInputStream();
                    }
                    if (v0_14 == null) {
                        String v3_13 = new StringBuilder();
                        v3_13.append(OneSignalRestClient: );
                        v3_13.append(p17);
                        v3_13.append( HTTP Code: );
                        v3_13.append(v7_1);
                        v3_13.append( No response body!);
                        com.onesignal.OneSignal.Log(com.onesignal.OneSignal$LOG_LEVEL.WARN, v3_13.toString());
                        v12_0 = 0;
                    } else {
                        String v4_7 = new java.util.Scanner(v0_14, UTF-8);
                        if (v4_7.useDelimiter(\A).hasNext()) {
                            v12_0 = v4_7.next();
                        }
                        v4_7.close();
                        String v3_16 = new StringBuilder();
                        v3_16.append(OneSignalRestClient: );
                        v3_16.append(p17);
                        v3_16.append( RECEIVED JSON: );
                        v3_16.append(v12_0);
                        com.onesignal.OneSignal.Log(com.onesignal.OneSignal$LOG_LEVEL.WARN, v3_16.toString());
                    }
                    v0_10 = com.onesignal.OneSignalRestClient.callResponseHandlerOnFailure(p19, v7_1, v12_0, 0);
                }
            }
        } catch (String v0_1) {
            v8_1 = 0;
        }
    }