花瓣 v4.6.12版本的 MD5 值为:6a3515d4d16d98931f1b3d25a91b257e

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


package com.sigmob.sdk.videocache;

import com.czhj.sdk.logger.SigmobLog;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Proxy;
import java.net.ProxySelector;
import java.net.Socket;
import java.net.URI;
import java.net.URISyntaxException;
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 class m {
    private static final String a = "ping";
    private static final String b = "ping ok";
    private final ExecutorService c = Executors.newSingleThreadExecutor();
    private final String f11489d;
    private final int f11490e;

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

        @Override
        public Boolean call() throws Exception {
            return Boolean.valueOf(m.this.b());
        }
    }

    public m(String str, int i2) {
        this.f11489d = (String) n.a(str);
        this.f11490e = i2;
    }

    private List<Proxy> a() {
        try {
            return ProxySelector.getDefault().select(new URI(c()));
        } catch (URISyntaxException e2) {
            throw new IllegalStateException(e2);
        }
    }

    public boolean b() throws p {
        j jVar = new j(c());
        try {
            byte[] bytes = b.getBytes();
            jVar.a(0L);
            byte[] bArr = new byte[bytes.length];
            jVar.a(bArr);
            boolean equals = Arrays.equals(bytes, bArr);
            SigmobLog.i("Ping response: `" + new String(bArr) + "`, pinged? " + equals);
            return equals;
        } catch (p e2) {
            SigmobLog.e("Error reading ping response", e2);
            return false;
        } finally {
            jVar.b();
        }
    }

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

    public void a(Socket socket) throws IOException {
        OutputStream outputStream = socket.getOutputStream();
        outputStream.write("HTTP/1.1 200 OK\n\n".getBytes());
        outputStream.write(b.getBytes());
    }

    public boolean a(int i2, int i3) {
        n.a(i2 >= 1);
        n.a(i3 > 0);
        int i4 = 0;
        while (i4 < i2) {
            try {
            } catch (InterruptedException e2) {
                e = e2;
                SigmobLog.w("Error pinging server due to unexpected error", e);
            } catch (ExecutionException e3) {
                e = e3;
                SigmobLog.w("Error pinging server due to unexpected error", e);
            } catch (TimeoutException unused) {
                SigmobLog.w("Error pinging server (attempt: " + i4 + ", timeout: " + i3 + "). ");
            }
            if (((Boolean) this.c.submit(new a()).get(i3, TimeUnit.MILLISECONDS)).booleanValue()) {
                return true;
            }
            i4++;
            i3 *= 2;
        }
        String format = 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(i4), Integer.valueOf(i3 / 2), a());
        SigmobLog.e(format, new p(format));
        return false;
    }

    public boolean a(String str) {
        return a.equals(str);
    }
}