EMOTIBOT v3.0.0版本的 MD5 值为:e78ae62c08f0ada6738206eeb97d2940
以下内容为反编译后的 rm.java 源代码,内容仅作参考
package p.a.y.e.a.s.e.net;
import android.content.Context;
import android.net.Uri;
import com.danikula.videocache.ProxyCacheException;
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class rm {
private static final String lite_char = "127.0.0.1";
private final nm lite_byte;
private final vm lite_case;
private final Object lite_do;
private final Map<String, sm> lite_for;
private final ExecutorService lite_if;
private final ServerSocket lite_int;
private final int lite_new;
private final Thread lite_try;
public static final class b {
private static final long lite_try = 536870912;
private File lite_do;
private pn lite_int;
private cn lite_for = new jn(536870912);
private en lite_if = new hn();
private mn lite_new = new ln();
public b(Context context) {
this.lite_int = qn.lite_if(context);
this.lite_do = bn.lite_for(context);
}
public nm lite_for() {
return new nm(this.lite_do, this.lite_if, this.lite_for, this.lite_int, this.lite_new);
}
public b lite_byte(mn mnVar) {
this.lite_new = (mn) wm.lite_int(mnVar);
return this;
}
public b lite_case(int i) {
this.lite_for = new in(i);
return this;
}
public b lite_char(long j) {
this.lite_for = new jn(j);
return this;
}
public rm lite_if() {
return new rm(lite_for());
}
public b lite_int(File file) {
this.lite_do = (File) wm.lite_int(file);
return this;
}
public b lite_new(cn cnVar) {
this.lite_for = (cn) wm.lite_int(cnVar);
return this;
}
public b lite_try(en enVar) {
this.lite_if = (en) wm.lite_int(enVar);
return this;
}
}
public final class c implements Runnable {
private final Socket lite_static;
public c(Socket socket) {
this.lite_static = socket;
}
@Override
public void run() {
rm.this.lite_break(this.lite_static);
}
}
public final class d implements Runnable {
private final CountDownLatch lite_static;
public d(CountDownLatch countDownLatch) {
this.lite_static = countDownLatch;
}
@Override
public void run() {
this.lite_static.countDown();
rm.this.lite_throw();
}
}
public rm(Context context) {
this(new b(context).lite_for());
}
private rm(nm nmVar) {
this.lite_do = new Object();
this.lite_if = Executors.newFixedThreadPool(8);
this.lite_for = new ConcurrentHashMap();
this.lite_byte = (nm) wm.lite_int(nmVar);
try {
ServerSocket serverSocket = new ServerSocket(0, 8, InetAddress.getByName(lite_char));
this.lite_int = serverSocket;
int localPort = serverSocket.getLocalPort();
this.lite_new = localPort;
um.lite_do(lite_char, localPort);
CountDownLatch countDownLatch = new CountDownLatch(1);
Thread thread = new Thread(new d(countDownLatch));
this.lite_try = thread;
thread.start();
countDownLatch.await();
this.lite_case = new vm(lite_char, localPort);
qm.lite_case("Proxy cache server started. Is it alive? " + lite_long());
} catch (IOException | InterruptedException e) {
this.lite_if.shutdown();
throw new IllegalStateException("Error starting local proxy server", e);
}
}
public void lite_break(Socket socket) {
StringBuilder sb;
try {
try {
om lite_for = om.lite_for(socket.getInputStream());
String lite_new = ym.lite_new(lite_for.lite_do);
if (this.lite_case.lite_int(lite_new)) {
this.lite_case.lite_byte(socket);
} else {
lite_case(lite_new).lite_int(lite_for, socket);
}
lite_class(socket);
sb = new StringBuilder();
} catch (Throwable th) {
lite_class(socket);
StringBuilder b2 = r5.b("Opened connections: ");
b2.append(lite_char());
qm.lite_case(b2.toString());
throw th;
}
} catch (ProxyCacheException e) {
e = e;
lite_void(new ProxyCacheException("Error processing request", e));
lite_class(socket);
sb = new StringBuilder();
} catch (SocketException unused) {
lite_class(socket);
sb = new StringBuilder();
} catch (IOException e2) {
e = e2;
lite_void(new ProxyCacheException("Error processing request", e));
lite_class(socket);
sb = new StringBuilder();
}
sb.append("Opened connections: ");
sb.append(lite_char());
qm.lite_case(sb.toString());
}
private File lite_byte(String str) {
nm nmVar = this.lite_byte;
return new File(nmVar.lite_do, nmVar.lite_if.lite_do(str));
}
private sm lite_case(String str) throws ProxyCacheException {
sm smVar;
synchronized (this.lite_do) {
smVar = this.lite_for.get(str);
if (smVar == null) {
smVar = new sm(str, this.lite_byte);
this.lite_for.put(str, smVar);
}
}
return smVar;
}
private int lite_char() {
int i;
synchronized (this.lite_do) {
i = 0;
Iterator<sm> it = this.lite_for.values().iterator();
while (it.hasNext()) {
i += it.next().lite_if();
}
}
return i;
}
private void lite_class(Socket socket) {
lite_new(socket);
lite_try(socket);
lite_int(socket);
}
private void lite_final() {
synchronized (this.lite_do) {
Iterator<sm> it = this.lite_for.values().iterator();
while (it.hasNext()) {
it.next().lite_try();
}
this.lite_for.clear();
}
}
private void lite_float(File file) {
try {
this.lite_byte.lite_for.lite_do(file);
} catch (IOException e) {
qm.lite_try("Error touching file " + file, e);
}
}
private String lite_for(String str) {
return String.format(Locale.US, "http://%s:%d/%s", lite_char, Integer.valueOf(this.lite_new), ym.lite_try(str));
}
private void lite_int(Socket socket) {
try {
if (socket.isClosed()) {
return;
}
socket.close();
} catch (IOException unused) {
}
}
private boolean lite_long() {
return this.lite_case.lite_new(3, 70);
}
private void lite_new(Socket socket) {
try {
if (socket.isInputShutdown()) {
return;
}
socket.shutdownInput();
} catch (SocketException | IOException unused) {
}
}
public void lite_throw() {
while (!Thread.currentThread().isInterrupted()) {
try {
this.lite_if.submit(new c(this.lite_int.accept()));
} catch (IOException e) {
lite_void(new ProxyCacheException("Error during waiting connection", e));
return;
}
}
}
private void lite_try(Socket socket) {
try {
if (socket.isOutputShutdown()) {
return;
}
socket.shutdownOutput();
} catch (IOException e) {
qm.lite_goto("Failed to close socket on proxy side: {}. It seems client have already closed connection.", e.getMessage());
}
}
private void lite_void(Throwable th) {
qm.lite_byte("HttpProxyCacheServer error", th.getMessage());
}
public void lite_catch(mm mmVar, String str) {
wm.lite_do(mmVar, str);
synchronized (this.lite_do) {
try {
lite_case(str).lite_new(mmVar);
} catch (ProxyCacheException e) {
qm.lite_goto("Error registering cache listener", e.getMessage());
}
}
}
public void lite_const() {
qm.lite_case("Shutdown proxy server");
lite_final();
this.lite_byte.lite_int.release();
this.lite_try.interrupt();
try {
if (this.lite_int.isClosed()) {
return;
}
this.lite_int.close();
} catch (IOException e) {
lite_void(new ProxyCacheException("Error shutting down proxy server", e));
}
}
public String lite_else(String str) {
return lite_goto(str, true);
}
public String lite_goto(String str, boolean z) {
if (!z || !lite_this(str)) {
return lite_long() ? lite_for(str) : str;
}
File lite_byte = lite_byte(str);
lite_float(lite_byte);
return Uri.fromFile(lite_byte).toString();
}
public void lite_short(mm mmVar) {
wm.lite_int(mmVar);
synchronized (this.lite_do) {
Iterator<sm> it = this.lite_for.values().iterator();
while (it.hasNext()) {
it.next().lite_case(mmVar);
}
}
}
public void lite_super(mm mmVar, String str) {
wm.lite_do(mmVar, str);
synchronized (this.lite_do) {
try {
lite_case(str).lite_case(mmVar);
} catch (ProxyCacheException e) {
qm.lite_goto("Error registering cache listener", e.getMessage());
}
}
}
public boolean lite_this(String str) {
wm.lite_new(str, "Url can't be null!");
return lite_byte(str).exists();
}
}