2012-10-23 2 views
0
나는 다음과 같은 코드에 의해 양말 프록시 서버를 설정할 수 있어요

:양말 프록시 설정을 해제하는 방법

System.setProperty("http.proxyHost", null); 
:

System.getProperties().setProperty("socksProxySet", "true"); 
    System.getProperties().setProperty("socksProxyHost", address); 
    System.getProperties().setProperty("socksProxyPort", port); 

Accordind http://docs.oracle.com/javase/6/docs/technotes/guides/net/proxies.html에, 나는이 같은 HTTP, HTTPS 및 FTP 프록시 설정을 해제 할 수 있습니다

질문 : 양말 프록시도 해제 할 수 있습니까? 이렇게함으로써

:

System.getProperties().setProperty("socksProxyHost", null); 

내가 NullPointerException이 아무것도 없어 ...

답변

0

타이 당신은뿐만 아니라 socksProxyPort을 취소해야 할 수도 있습니다.

socksProxySet은 상상이며 아무 것도 수행하지 않습니다. 도도 httpProxySet, http.proxySet, https.proxySet 등 여러 권의 책에도 불구하고.

그러나 프록시를 사용하고 사용하지 않으면 이런 종류의 일에 실제로 java.net.Proxy을 사용해야합니다.

+0

예, Proxy 클래스가 훨씬 더 나은 방법이라는 것을 알고 있습니다. 그러나 구현하지 않은 확장 된 코드를 사용하고 있으며 지금은 변경하기가 실용적이지 않을 것입니다. 나는 항구를 개간하고있다. 다른 생각? – Drugo

0

사용 :

System.clearProperty("http.proxySet"); 
System.clearProperty("http.proxyHost"); 
System.clearProperty("http.proxyPort"); 

이 프록시 설정을 취소합니다.

관련 문제