展开全部在JAVA中怎么设置代理服务器呢,非常简单public void setServiceProxy(Config config) { this.config = config; System.setProperty("http.proxyHost", config.getProxyHost()); System.setProperty("http.proxyPort", config.getProxyPort()); System.setProperty("https.proxyHost", config.getProxyHost()); System.setProperty("https.proxyPort", config.getProxyPort()); }然后在每一个HttpUrlConnection请求中,设置代理服务器用户名和密码,并进行Base64加密(看你代理服务器的要求,可能因代理服务器不同而不同),代码如下private HttpURLConnection getProxyHttpConnection() throws IOException { String authorization = config.getProxyUser() + ":" + config.getProxyPassword(); URL url = new URL(config.getRequestUrl()); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestProperty("Proxy-Authorization", "Basic " + Base64.encodeBase64String(authorization.getBytes())); return conn; }