By default, Fiddler cannot listen to Java httpurlconnection requests. The reason is that the Java Network Communication Protocol Stack may be slightly different from the browser's communication protocol stack. The principle of Fiddler listening to HTTP requests is in ApplicationProgramA proxy server is built between the network communication layer of the operating system, and Java's httpurlconnection should bypass this proxy server, so Fiddler cannot listen to Java httpurlconnection requests.
The basic idea of resolving Fiddler's inability to listen to Java httpurlconnection requests is to set up a proxy server.
The solution provided by the fiddler official website (see http://www.fiddler2.com/fiddler/help/hookup.asp#Q-JavaTraffic) is to set JVM parameters, such
JRE-dproxyset = true-dproxyhost = 127.0.0.1-dproxyport = 8888 MyApp
The cool people on stackoverflow also gaveCodeTo set the proxy server (see the http://stackoverflow.com/questions/8549749/how-to-capture-https-with-fiddler-in-java), as shown in
System. setproperty ("HTTP. proxyhost", "localhost ");
System. setproperty ("HTTP. proxyport", "8888 ");
System. setproperty ("HTTPS. proxyhost", "localhost ");
System. setproperty ("HTTPS. proxyport", "8888 ");
Of course, it is better to hope that Fiddler itself can increase the ability to listen to Java httpurlconnection requests.