Proxy Master v3.4.9版本的 MD5 值为:14d0aa2468d13530c8f6e96bcc114bf5
以下内容为反编译后的 h.java 源代码,内容仅作参考
package sg.bigo.ads.core.player.a;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.Proxy;
import java.net.ProxySelector;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import sg.bigo.ads.common.k;
public final class h {
private final ExecutorService f34456a = Executors.newSingleThreadExecutor(new sg.bigo.ads.common.i.b("Ping"));
private final String f34457b;
private final int f34458c;
public class a implements Callable<Boolean> {
private a() {
}
public a(h hVar, byte b6) {
this();
}
@Override
public final Boolean call() {
return Boolean.valueOf(h.this.b());
}
}
public h(String str, int i10) {
this.f34457b = (String) k.a(str);
this.f34458c = i10;
}
private List<Proxy> c() {
ArrayList arrayList = new ArrayList();
try {
return ProxySelector.getDefault().select(new URI(d()));
} catch (URISyntaxException e10) {
sg.bigo.ads.common.n.a.a(0, "ProxyCache", "Pinger#getDefaultProxies, error message is : " + e10.toString());
return arrayList;
}
}
private String d() {
return String.format(Locale.US, "http://%s:%d/%s", this.f34457b, Integer.valueOf(this.f34458c), "ping");
}
public final boolean a() {
String g10;
int i10 = 70;
int i11 = 0;
while (i11 < 3) {
try {
} catch (InterruptedException | ExecutionException unused) {
g10 = "Error pinging server due to unexpected error";
sg.bigo.ads.common.n.a.a(0, "ProxyCache", g10);
i11++;
i10 *= 2;
} catch (TimeoutException unused2) {
g10 = android.support.v4.media.a.g("Error pinging server (attempt: ", i11, ", timeout: ", i10, "). ");
sg.bigo.ads.common.n.a.a(0, "ProxyCache", g10);
i11++;
i10 *= 2;
}
if (((Boolean) this.f34456a.submit(new a(this, (byte) 0)).get(i10, TimeUnit.MILLISECONDS)).booleanValue()) {
return true;
}
i11++;
i10 *= 2;
}
sg.bigo.ads.common.n.a.a(0, "ProxyCache", String.format(Locale.US, "Error pinging server (attempts: %d, max timeout: %d). If you see this message, please, report at https://github.com/danikula/AndroidVideoCache/issues/134. Default proxies are: %s", Integer.valueOf(i11), Integer.valueOf(i10 / 2), c()));
return false;
}
public final boolean b() {
g gVar = new g(d());
try {
byte[] bytes = "ping ok".getBytes();
try {
HttpURLConnection b6 = gVar.b();
gVar.f34453a = b6;
if (b6 != null) {
gVar.f34454b = new BufferedInputStream(gVar.f34453a.getInputStream(), 8192);
}
} catch (IOException e10) {
sg.bigo.ads.common.n.a.a(0, "ProxyCache", "Error opening connection for " + gVar.f34455c + " with offset 0, error message is : " + e10.toString());
}
byte[] bArr = new byte[bytes.length];
gVar.a(bArr);
boolean equals = Arrays.equals(bytes, bArr);
sg.bigo.ads.common.n.a.a(0, 3, "ProxyCache", "Ping response: `" + new String(bArr) + "`, pinged? " + equals);
return equals;
} finally {
gVar.a();
}
}
}