中建乐购 v3.2.3版本的 MD5 值为:3856d0da11f056931d64951d23a4b3b8
以下内容为反编译后的 m.java 源代码,内容仅作参考
package com.danikula.videocache;
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;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class m {
private static final Logger f6106a = LoggerFactory.getLogger("Pinger");
private static final String f6107b = "ping";
private static final String f6108c = "ping ok";
private final ExecutorService f6109d = Executors.newSingleThreadExecutor();
private final String f6110e;
private final int f6111f;
public m(String str, int i2) {
this.f6110e = (String) n.a(str);
this.f6111f = i2;
}
public boolean a(int i2, int i3) {
n.a(i2 >= 1);
n.a(i3 > 0);
int i4 = i3;
int i5 = 0;
while (i5 < i2) {
try {
} catch (InterruptedException | ExecutionException e2) {
f6106a.error("Error pinging server due to unexpected error", e2);
} catch (TimeoutException unused) {
f6106a.warn("Error pinging server (attempt: " + i5 + ", timeout: " + i4 + "). ");
}
if (((Boolean) this.f6109d.submit(new a()).get(i4, TimeUnit.MILLISECONDS)).booleanValue()) {
return true;
}
i5++;
i4 *= 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(i5), Integer.valueOf(i4 / 2), a());
f6106a.error(format, (Throwable) new ProxyCacheException(format));
return false;
}
private List<Proxy> a() {
try {
return ProxySelector.getDefault().select(new URI(c()));
} catch (URISyntaxException e2) {
throw new IllegalStateException(e2);
}
}
public boolean a(String str) {
return f6107b.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(f6108c.getBytes());
}
public boolean b() throws ProxyCacheException {
k kVar = new k(c());
try {
byte[] bytes = f6108c.getBytes();
kVar.a(0L);
byte[] bArr = new byte[bytes.length];
kVar.a(bArr);
boolean equals = Arrays.equals(bytes, bArr);
Logger logger = f6106a;
logger.info("Ping response: `" + new String(bArr) + "`, pinged? " + equals);
return equals;
} catch (ProxyCacheException e2) {
f6106a.error("Error reading ping response", (Throwable) e2);
return false;
} finally {
kVar.b();
}
}
private String c() {
return String.format(Locale.US, "http://%s:%d/%s", this.f6110e, Integer.valueOf(this.f6111f), f6107b);
}
private class a implements Callable<Boolean> {
private a() {
}
@Override
public Boolean call() throws Exception {
return Boolean.valueOf(m.this.b());
}
}
}