正在查看: 饼干视频 v4.1.0 应用的 m.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 饼干视频 v4.1.0 应用的 m.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.octopus.ad.internal.b;
import com.octopus.ad.internal.utilities.HaoboLog;
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 m {
private final ExecutorService a = Executors.newSingleThreadExecutor();
private final String b;
private final int c;
public class a implements Callable<Boolean> {
private a() {
}
@Override
public Boolean call() throws Exception {
return Boolean.valueOf(m.this.b());
}
}
public m(String str, int i) {
this.b = (String) n.a(str);
this.c = i;
}
public boolean b() throws p {
j jVar = new j(c());
try {
byte[] bytes = "ping ok".getBytes();
jVar.a(0L);
byte[] bArr = new byte[bytes.length];
jVar.a(bArr);
boolean equals = Arrays.equals(bytes, bArr);
HaoboLog.i(HaoboLog.pingerLogTag, "Ping response: `" + new String(bArr) + "`, pinged? " + equals);
return equals;
} catch (p e) {
HaoboLog.e(HaoboLog.pingerLogTag, "Error reading ping response", e);
return false;
} finally {
jVar.b();
}
}
private String c() {
return String.format(Locale.US, "http://%s:%d/%s", this.b, Integer.valueOf(this.c), "ping");
}
public boolean a(int i, int i2) {
n.a(i >= 1);
n.a(i2 > 0);
int i3 = 0;
while (i3 < i) {
try {
} catch (InterruptedException e) {
e = e;
HaoboLog.e(HaoboLog.pingerLogTag, "Error pinging server due to unexpected error", e);
} catch (ExecutionException e2) {
e = e2;
HaoboLog.e(HaoboLog.pingerLogTag, "Error pinging server due to unexpected error", e);
} catch (TimeoutException unused) {
HaoboLog.w(HaoboLog.pingerLogTag, "Error pinging server (attempt: " + i3 + ", timeout: " + i2 + "). ");
}
if (((Boolean) this.a.submit(new a()).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());
HaoboLog.e(HaoboLog.pingerLogTag, format + new p(format));
return false;
}
private List<Proxy> a() {
try {
return ProxySelector.getDefault().select(new URI(c()));
} catch (URISyntaxException e) {
throw new IllegalStateException(e);
}
}
public boolean a(String str) {
return "ping".equals(str);
}
public void a(Socket socket) throws IOException {
OutputStream outputStream = socket.getOutputStream();
outputStream.write("HTTP/1.1 200 OK\n\n".getBytes());
outputStream.write("ping ok".getBytes());
}
}