Properties systemSettings = System.getProperties();
systemSettings.put("http.proxyHost","192.168.0.254") ;
systemSettings.put("http.proxyPort", "3128");
Hello... I'm using this code to create a proxy... BUT how will I know
that my program is indeed using the proxy? Is there a way? Please do
reply . . .
Alex - 06 May 2006 09:12 GMT
IveCal a écrit :
> Properties systemSettings = System.getProperties();
> systemSettings.put("http.proxyHost","192.168.0.254") ;
[quoted text clipped - 3 lines]
> that my program is indeed using the proxy? Is there a way? Please do
> reply . . .
I'm using this :
URLConnection connection;
if (config.PROXY) {
connection = new URL("http", config.PROXY_URL, config.PROXY_PORT,
url).openConnection();
} else {
connection = new URL(url).openConnection();
}
and it's working fine.
If you want to test if it's really working, you can test to
access a webpage?

Signature
Alex
IveCal - 06 May 2006 09:33 GMT
thanks alex... But may I know what config is? what variable is it?
Alex - 06 May 2006 23:15 GMT
IveCal a écrit :
> thanks alex... But may I know what config is? what variable is it?
it's a class where I wrote my all the parameters of my software :
public class config {
public static final boolean PROXY = true;
public static final String PROXY_URL = "127.0.0.1";
public static final int PROXY_PORT = 1234;
}
IveCal - 07 May 2006 13:36 GMT
Ah, Ok . . . thanks a lot alex . . .
Alex Hunsley - 09 May 2006 00:01 GMT
> Properties systemSettings = System.getProperties();
> systemSettings.put("http.proxyHost","192.168.0.254") ;
[quoted text clipped - 3 lines]
> that my program is indeed using the proxy? Is there a way? Please do
> reply . . .
You could download ethereal (a network sniffer) and watch what ip/port
your process is connecting to. Or alternatively, consider using an HTTP
proxy like Proximotron (it's free): point your Java code at this proxy,
and open the Proxomitron log window to see if a connection is being made
when you think it is.
IveCal - 11 May 2006 09:38 GMT
Thanks a lot . . . Alex . . . I'll just post questions if get some more
errors . . .