Hi,
I am trying to invoke url from java. I used the following code to do this:
URL url = null;
HttpURLConnection connection = null;
InputStream inStream = null;
Authenticator.setDefault(new UserAuthenticate("itlinfosys\\chaya_somanchi", "mypwd"));
System.out.println("After Authenticator");
String proxy_addr = "172.25.232.28";
int proxy_port = 80;
addr = new InetSocketAddress(proxy_addr,proxy_port);
System.out.println("After SocketAddress "+addr.toString());
System.out.println("Proxy Type: "+Proxy.Type.HTTP.toString());
proxy = new Proxy(Proxy.Type.HTTP, addr);
connection = (HttpURLConnection)url.openConnection(proxy);
connection.connect();
inStream = connection.getInputStream();
return inStream;
But there is some problem with Proxy.Type.HTTP. Its not showing any error or exception. In the console, it just stops after printing �After SocketAddress� line. I have manually tested my proxy address and port in IE and they are correct(iam able to connect to internet using these).
Do let me know if you have any suggestions on this. Or it would be great if you have any other code to invoke a url. I just want to invoke a url like google.com and get the resultant html as an inputstream.
Thanks in advance.