4399游戏盒 v7.2.1.31版本的 MD5 值为:951717f45e3fda95c8a358caf4ca93e1
以下内容为反编译后的 NetworkCheckHandler.java 源代码,内容仅作参考
package com.framework.net;
import android.text.TextUtils;
import com.framework.manager.network.NetworkStatusManager;
import java.net.InetSocketAddress;
import java.net.Socket;
public class NetworkCheckHandler {
public enum NetWorkKind {
UnAvalible,
NoNet,
HasNet
}
public static NetWorkKind checkNetwork() {
if (!NetworkStatusManager.getCurrentNetwork().networkAvalible()) {
return NetWorkKind.UnAvalible;
}
return checkReachable("www.baidu.com");
}
public static NetWorkKind checkReachable(String str) {
Socket socket;
NetWorkKind netWorkKind = NetWorkKind.NoNet;
if (TextUtils.isEmpty(str)) {
throw new NullPointerException("host can't null");
}
Socket socket2 = null;
try {
try {
try {
socket = new Socket();
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception e2) {
e = e2;
}
} catch (Throwable th) {
th = th;
socket = socket2;
}
try {
socket.connect(new InetSocketAddress(str, 80), 4000);
netWorkKind = NetWorkKind.HasNet;
socket.close();
} catch (Exception e3) {
e = e3;
socket2 = socket;
e.printStackTrace();
if (socket2 != null) {
socket2.close();
}
return netWorkKind;
} catch (Throwable th2) {
th = th2;
if (socket != null) {
try {
socket.close();
} catch (Exception e4) {
e4.printStackTrace();
}
}
throw th;
}
return netWorkKind;
}
}