Cyber Surfer v5.2.5版本的 MD5 值为:db13c5fce988de393e52d2679f934b22

以下内容为反编译后的 h.java 源代码,内容仅作参考


package sg.bigo.ads.core.player.a;

import java.io.BufferedInputStream;
import java.io.IOException;
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;
public final class h {
    private final ExecutorService f16436a = Executors.newSingleThreadExecutor();
    private final String f16437b;
    private final int c;

    class a implements Callable<Boolean> {
        private a() {
        }

        a(h hVar, byte b2) {
            this();
        }

        @Override
        public final Boolean call() {
            return Boolean.valueOf(h.this.b());
        }
    }

    public h(String str, int i) {
        this.f16437b = (String) sg.bigo.ads.common.g.a(str);
        this.c = i;
    }

    private List<Proxy> c() {
        ArrayList arrayList = new ArrayList();
        try {
            return ProxySelector.getDefault().select(new URI(d()));
        } catch (URISyntaxException e) {
            sg.bigo.ads.common.k.a.a(0, "ProxyCache", "Pinger#getDefaultProxies, error message is : " + e.toString());
            return arrayList;
        }
    }

    private String d() {
        return String.format(Locale.US, "http://%s:%d/%s", this.f16437b, Integer.valueOf(this.c), "ping");
    }

    public final boolean a() {
        String str;
        int i = 70;
        int i2 = 0;
        while (i2 < 3) {
            try {
            } catch (InterruptedException | ExecutionException unused) {
                str = "Error pinging server due to unexpected error";
                sg.bigo.ads.common.k.a.a(0, "ProxyCache", str);
                i2++;
                i *= 2;
            } catch (TimeoutException unused2) {
                str = "Error pinging server (attempt: " + i2 + ", timeout: " + i + "). ";
                sg.bigo.ads.common.k.a.a(0, "ProxyCache", str);
                i2++;
                i *= 2;
            }
            if (((Boolean) this.f16436a.submit(new a(this, (byte) 0)).get(i, TimeUnit.MILLISECONDS)).booleanValue()) {
                return true;
            }
            i2++;
            i *= 2;
        }
        sg.bigo.ads.common.k.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(i2), Integer.valueOf(i / 2), c()));
        return false;
    }

    final boolean b() {
        g gVar = new g(d());
        try {
            byte[] bytes = "ping ok".getBytes();
            try {
                gVar.f16434a = gVar.b();
                if (gVar.f16434a != null) {
                    gVar.f16435b = new BufferedInputStream(gVar.f16434a.getInputStream(), 8192);
                }
            } catch (IOException e) {
                sg.bigo.ads.common.k.a.a(0, "ProxyCache", "Error opening connection for " + gVar.c + " with offset 0, error message is : " + e.toString());
            }
            byte[] bArr = new byte[bytes.length];
            gVar.a(bArr);
            boolean equals = Arrays.equals(bytes, bArr);
            sg.bigo.ads.common.k.a.a(0, 3, "ProxyCache", "Ping response: `" + new String(bArr) + "`, pinged? " + equals);
            return equals;
        } finally {
            gVar.a();
        }
    }
}