方法很简单,就是设置本地代理
C#
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); req.Proxy = new WebProxy("127.0.0.1:8888", true);
Java
jre -DproxySet=true -DproxyHost=127.0.0.1 -DproxyPort=8888 MyApp
或者
System.setProperty("http.proxyHost", "localhost"); System.setProperty("http.proxyPort", "8888"); System.setProperty("https.proxyHost", "localhost"); System.setProperty("https.proxyPort", "8888");