如何强制 Java 小程序的网络流量通过 Fiddler?
我试图强制我的 Java 小程序的 HTTP 网络流量通过 Fiddler,但我没有任何运气。 Fiddler 正在我的本地主机上的端口 8888 上运行,因此我在小程序中设置了这些值:
System.getProperties().put("proxyHost", "localhost");
System.getProperties().put("proxyPort", "8888");
当我这样做时,一旦我尝试创建套接字,就会在 Java 控制台中收到以下异常:
java.net.SocketException:未知代理类型:HTTP
根据 Java bug 6370908 ,socket 类不支持 HTTP 代理类型。所以我的问题是,如何通过 Fiddler 驱动我的套接字流量?如果无法完成,是否有其他网络监控工具可以让我查看流量?我不是网络专家,所以也许我在这里遗漏了一些简单的东西。
我还应该注意到,直接从 Eclipse 运行似乎是不可能的,因为我的小程序期望存在各种 HTML 页面元素。
I'm trying to force my Java applet's HTTP network traffic through Fiddler, and I'm not having any luck. Fiddler is running on my localhost on port 8888, and so I have set these values in my applet:
System.getProperties().put("proxyHost", "localhost");
System.getProperties().put("proxyPort", "8888");
When I do this, I get the following exception in the Java Console as soon as I try to create a socket:
java.net.SocketException: Unknown proxy type : HTTP
According to Java bug 6370908, the HTTP proxy type is not supported by the socket class. So my question is, how can I drive my socket traffic through Fiddler? If it cannot be done, is there some other network monitoring tool that will allow me to see the traffic? I'm not a networking expert, so maybe I'm missing something simple here.
I should also note that running directly from Eclipse doesn't seem possible, since my applet is expecting various HTML page elements to be present.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不知道是否可以使用 Fiddler,但你可以尝试 Wireshark 。
I don't know if it's possible using Fiddler but you could give Wireshark a try.
尝试检查 Java 控制面板中的 Java 网络设置。从“直接连接”切换到“使用浏览器设置”对我很有帮助。
转到控制面板 -> Java->一般->网络设置并选择“使用浏览器设置”。
Try to check Java Networking Settings in Java Control Panel. Switching from "Direct connection" to "Use browser settings" have helped me.
Go Control Panel -> Java -> General -> Network Settings and select "Use browser settings".
Java 控制面板中的 Java 网络设置对我有用,但是请确保您使用计算机的外部 IP 地址而不是 localhost 或 127.0.0.1。
Java Networking Settings in Java Control Panel worked for me however make sure you use your machine external ip address rather than localhost or 127.0.0.1.