java设置代理

// 通过代理访问外网

Properties systemProperties = System.getProperties();

systemProperties.setProperty("http.proxyHost", proxyHost);

systemProperties.setProperty("http.proxyPort", proxyPort);


HttpClientParams params = new HttpClientParams();

// 避免'Expect: 100-continue' handshake

params.setParameter(HttpClientParams.USE_EXPECT_CONTINUE,

Boolean.FALSE);

// 设置ws连接超时时间

params.setParameter(HttpClientParams.CONNECTION_MANAGER_TIMEOUT,

1000L);


你可能感兴趣的:(java,代理)