导航菜单

页面标题

页面副标题

饼干视频 v4.1.0 - l.java 源代码

正在查看: 饼干视频 v4.1.0 应用的 l.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.moqi.sdk.videocache;

import com.moqi.sdk.utils.t;
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;

class l {
    private static final String e = "ping";
    private static final String f = "ping ok";
    private String a = "MoQi_Pinger";
    private final ExecutorService b = Executors.newSingleThreadExecutor();
    private final String c;
    private final int d;

    public class b implements Callable<Boolean> {
        private b() {
        }

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

    public l(String str, int i) {
        this.c = (String) m.a(str);
        this.d = i;
    }

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

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

    public boolean c() throws ProxyCacheException {
        j jVar = new j(b());
        try {
            try {
                byte[] bytes = f.getBytes();
                jVar.a(0L);
                byte[] bArr = new byte[bytes.length];
                jVar.read(bArr);
                boolean equals = Arrays.equals(bytes, bArr);
                t.c(this.a, "Ping response: `" + new String(bArr) + "`, pinged? " + equals);
                return equals;
            } catch (ProxyCacheException e2) {
                t.c(this.a, "Error reading ping response|" + e2.getMessage());
                jVar.close();
                return false;
            }
        } finally {
            jVar.close();
        }
    }

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

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

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