admin管理员组文章数量:1567261
2024年1月21日发(作者:)
public class SocketCheckThread implements Callable
/** * 等待超时时间 */ private final int SEC_WAIT = 5;
private String ip;
public SocketCheckThread(String ip) { = ip; }
@Override public CheckStatus call() { CheckStatus checkStatus = new CheckStatus(); (ip); tus(check()); return checkStatus; }
private boolean check() { Socket socket = null; try {
Proxy proxy = createProxy(); socket = new Socket(proxy); t(new InetSocketAddress( ,80), SEC_WAIT * 1000); return true; } catch (Exception e) { ("检测超时{}",,e); } finally { try { (); } catch (IOException e) { ("关闭socket失败",sage()); } } return false; }
private static Proxy createProxy() { // 设置认证 String proxyAddr = ip; int proxyPort = port; ault(new Authenticator(){ @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("user", "password".toCharArray()); } });
SocksProxy proxy = (new InetSocketAddress(proxyAddr, proxyPort),5); return proxy; } }
版权声明:本文标题:Linux上socket5代理服务器搭建 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dongtai/1705819939a157313.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论