We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我的main方法代码:
> public static void main(String[] args) { > String proxyIp = "proxyIp"; > Integer proxyPort = 823; > String proxyUsername = "proxyUsername"; > String proxyPassword = "proxyPassword"; > HttpProxyServer httpProxyServer = null; > for (int i = 0; i < 6; i++) { > try { > httpProxyServer = new HttpProxyServer(); > httpProxyServer.proxyConfig(new ProxyConfig(ProxyType.HTTP, proxyIp, proxyPort, proxyUsername, proxyPassword)).startAsync(9999); > HttpRequest httpRequest = HttpRequest.get("https://api.ipapi.is").timeout(30000); > httpRequest.setProxy(new Proxy(Proxy.Type.HTTP,new InetSocketAddress("127.0.0.1",9999))); > String ipInfo = httpRequest.execute().body(); > JSONObject ipJSONObject = JSONObject.parseObject(ipInfo); > System.out.println(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss") +" timezone:"+ipJSONObject.getJSONObject("location").getString("timezone") + " ip:"+ipJSONObject.getString("ip")); > } catch (Exception e) { > e.printStackTrace(); > } finally { > httpProxyServer.close(); > System.out.println(" "); > try { > Thread.sleep(3000l); > } catch (InterruptedException e) { > throw new RuntimeException(e); > } > } > } > }
执行日志:
> 2024-09-12 10:04:03 timezone:America/New_York ip:24.186.122.183 > 10:04:03.349 [nioEventLoopGroup-3-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0xd1d1d081, L:/0:0:0:0:0:0:0:0:9999] INACTIVE > 10:04:03.349 [nioEventLoopGroup-3-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0xd1d1d081, L:/0:0:0:0:0:0:0:0:9999] UNREGISTERED > > 10:04:05.375 [nioEventLoopGroup-4-1] DEBUG io.netty.buffer.PoolThreadCache - Freed 4 thread-local buffer(s) from thread: nioEventLoopGroup-4-1 > 10:04:05.462 [nioEventLoopGroup-2-1] DEBUG io.netty.buffer.PoolThreadCache - Freed 4 thread-local buffer(s) from thread: nioEventLoopGroup-2-1 > 10:04:06.467 [nioEventLoopGroup-6-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0xdea628af] REGISTERED > 10:04:06.468 [nioEventLoopGroup-6-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0xdea628af] BIND: 0.0.0.0/0.0.0.0:9999 > 10:04:06.472 [nioEventLoopGroup-6-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0xdea628af, L:/0:0:0:0:0:0:0:0:9999] ACTIVE > 10:04:06.475 [nioEventLoopGroup-6-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0xdea628af, L:/0:0:0:0:0:0:0:0:9999] READ: [id: 0xcfc84d9e, L:/127.0.0.1:9999 - R:/127.0.0.1:65272] > 10:04:06.476 [nioEventLoopGroup-6-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0xdea628af, L:/0:0:0:0:0:0:0:0:9999] READ COMPLETE > 2024-09-12 10:04:10 timezone:America/New_York ip:98.14.211.198 > 10:04:10.318 [nioEventLoopGroup-6-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0xdea628af, L:/0:0:0:0:0:0:0:0:9999] INACTIVE > 10:04:10.318 [nioEventLoopGroup-6-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0xdea628af, L:/0:0:0:0:0:0:0:0:9999] UNREGISTERED > > 10:04:12.335 [nioEventLoopGroup-7-1] DEBUG io.netty.buffer.PoolThreadCache - Freed 4 thread-local buffer(s) from thread: nioEventLoopGroup-7-1 > 10:04:12.432 [nioEventLoopGroup-5-1] DEBUG io.netty.buffer.PoolThreadCache - Freed 4 thread-local buffer(s) from thread: nioEventLoopGroup-5-1 > 10:04:13.413 [nioEventLoopGroup-9-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0x1b01ccbc] REGISTERED > 10:04:13.414 [nioEventLoopGroup-9-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0x1b01ccbc] BIND: 0.0.0.0/0.0.0.0:9999 > 10:04:13.420 [nioEventLoopGroup-9-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0x1b01ccbc, L:/0:0:0:0:0:0:0:0:9999] ACTIVE > 10:04:13.430 [nioEventLoopGroup-9-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0x1b01ccbc, L:/0:0:0:0:0:0:0:0:9999] INACTIVE > 10:04:13.430 [nioEventLoopGroup-9-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0x1b01ccbc, L:/0:0:0:0:0:0:0:0:9999] UNREGISTERED > cn.hutool.http.HttpException: Connection refused: connect > at cn.hutool.http.HttpResponse.init(HttpResponse.java:568) > at cn.hutool.http.HttpResponse.initWithDisconnect(HttpResponse.java:541) > at cn.hutool.http.HttpResponse.<init>(HttpResponse.java:83) > at cn.hutool.http.HttpRequest.doExecute(HttpRequest.java:1195) > at cn.hutool.http.HttpRequest.execute(HttpRequest.java:1051) > at cn.hutool.http.HttpRequest.execute(HttpRequest.java:1027) > at com.overseas.utils.ProxyUtil.getIp(ProxyUtil.java:60) > at com.overseas.utils.ProxyUtil.main(ProxyUtil.java:33) > Caused by: java.net.ConnectException: Connection refused: connect > at java.base/java.net.PlainSocketImpl.waitForConnect(Native Method) > at java.base/java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:107) > at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) > at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) > at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) > at java.base/java.net.Socket.connect(Socket.java:608) > at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:177) > at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:510) > at java.base/sun.net.www.http.HttpClient$1.run(HttpClient.java:562) > at java.base/sun.net.www.http.HttpClient$1.run(HttpClient.java:560) > at java.base/java.security.AccessController.doPrivileged(Native Method) > at java.base/sun.net.www.http.HttpClient.privilegedOpenServer(HttpClient.java:559) > at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:600) > at java.base/sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:745) > at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1637) > at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1542) > at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527) > at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:334) > at cn.hutool.http.HttpConnection.responseCode(HttpConnection.java:482) > at cn.hutool.http.HttpResponse.init(HttpResponse.java:565) > ... 7 more > > 10:04:16.528 [nioEventLoopGroup-12-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0xe5da100c] REGISTERED > 10:04:16.528 [nioEventLoopGroup-12-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0xe5da100c] BIND: 0.0.0.0/0.0.0.0:9999 > 10:04:16.533 [nioEventLoopGroup-12-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0xe5da100c, L:/0:0:0:0:0:0:0:0:9999] ACTIVE > 10:04:16.542 [nioEventLoopGroup-12-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0xe5da100c, L:/0:0:0:0:0:0:0:0:9999] INACTIVE > 10:04:16.542 [nioEventLoopGroup-12-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0xe5da100c, L:/0:0:0:0:0:0:0:0:9999] UNREGISTERED > > cn.hutool.core.io.IORuntimeException: ConnectException: Connection refused: connect > at cn.hutool.http.HttpRequest.send(HttpRequest.java:1350) > at cn.hutool.http.HttpRequest.doExecute(HttpRequest.java:1188) > at cn.hutool.http.HttpRequest.execute(HttpRequest.java:1051) > at cn.hutool.http.HttpRequest.execute(HttpRequest.java:1027) > at com.overseas.utils.ProxyUtil.getIp(ProxyUtil.java:60) > at com.overseas.utils.ProxyUtil.main(ProxyUtil.java:33) > Caused by: java.net.ConnectException: Connection refused: connect > at java.base/java.net.PlainSocketImpl.waitForConnect(Native Method) > at java.base/java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:107) > at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) > at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) > at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) > at java.base/java.net.Socket.connect(Socket.java:608) > at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:177) > at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:510) > at java.base/sun.net.www.http.HttpClient$1.run(HttpClient.java:562) > at java.base/sun.net.www.http.HttpClient$1.run(HttpClient.java:560) > at java.base/java.security.AccessController.doPrivileged(Native Method) > at java.base/sun.net.www.http.HttpClient.privilegedOpenServer(HttpClient.java:559) > at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:600) > at java.base/sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:265) > at java.base/sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:372) > at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:207) > at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1232) > at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1081) > at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:193) > at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:168) > at cn.hutool.http.HttpConnection.connect(HttpConnection.java:387) > at cn.hutool.http.HttpRequest.send(HttpRequest.java:1345) > ... 5 more
The text was updated successfully, but these errors were encountered:
No branches or pull requests
我的main方法代码:
执行日志:
The text was updated successfully, but these errors were encountered: