package com.netease.nrtc.engine.impl; import android.text.TextUtils; import androidx.vectordrawable.graphics.drawable.PathInterpolatorCompat; import com.netease.nrtc.engine.rawapi.IRtcRoomServerHandler; import com.netease.yunxin.base.http.AsyncHttpURLConnection; import com.sina.weibo.sdk.auth.Oauth2AccessToken; import cz.msebera.android.httpclient.HttpHost; import java.util.HashMap; import java.util.Locale; import org.json.JSONException; import org.json.JSONObject; public class h { /* renamed from: a reason: collision with root package name */ private static String f10628a = "https://roomserver.netease.im/v1/sdk/command/rooms"; public static void a(long j, long j2, String str, long j3, final IRtcRoomServerHandler iRtcRoomServerHandler) throws Exception { String format = String.format(Locale.getDefault(), "%s/%d", f10628a, Long.valueOf(j2)); HashMap<String, String> hashMap = new HashMap<>(); hashMap.put("Token", str); JSONObject jSONObject = new JSONObject(); jSONObject.put("suid", j3); jSONObject.put("cid", j2); jSONObject.put(Oauth2AccessToken.KEY_UID, j); jSONObject.put("cmd", 10001); AsyncHttpURLConnection asyncHttpURLConnection = new AsyncHttpURLConnection(format, jSONObject.toString(), new AsyncHttpURLConnection.AsyncHttpEvents() { /* class com.netease.nrtc.engine.impl.h.AnonymousClass1 */ @Override // com.netease.yunxin.base.http.AsyncHttpURLConnection.AsyncHttpEvents public void onHttpComplete(String str) { try { JSONObject jSONObject = new JSONObject(str); int optInt = jSONObject.optInt("code", -1); if (iRtcRoomServerHandler == null) { return; } if (optInt == 200) { iRtcRoomServerHandler.onResult(200, "success"); } else { iRtcRoomServerHandler.onResult(optInt, jSONObject.optString("errmsg")); } } catch (JSONException e2) { e2.printStackTrace(); IRtcRoomServerHandler iRtcRoomServerHandler = iRtcRoomServerHandler; if (iRtcRoomServerHandler != null) { iRtcRoomServerHandler.onResult(400, str); } } } @Override // com.netease.yunxin.base.http.AsyncHttpURLConnection.AsyncHttpEvents public void onHttpError(int i, String str) { IRtcRoomServerHandler iRtcRoomServerHandler = iRtcRoomServerHandler; if (iRtcRoomServerHandler != null) { iRtcRoomServerHandler.onResult(i, str); } } }); asyncHttpURLConnection.setHead(hashMap); asyncHttpURLConnection.setTimeOut(PathInterpolatorCompat.MAX_NUM_POINTS); asyncHttpURLConnection.send(); } public static void a(String str) { if (TextUtils.isEmpty(str)) { return; } if (str.startsWith(HttpHost.DEFAULT_SCHEME_NAME) || str.startsWith("https")) { f10628a = str; } } }