Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2006

Tip: Looking for answers? Try searching our database.

proxy

Thread view: 
IveCal - 06 May 2006 08:03 GMT
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 . . .


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.