HttpURLConnection UsingProxy() Example
Indicates if the connection is going through a proxy.
HttpURLConnectionclass UsingProxy() method example. This example shows you how to use UsingProxy() method.This method Indicates if the connection is going through a proxy.
Here is the code:-
/*
* @Program that Indicates if the connection is going through a proxy.
* UsingProxy.java
* Author:-RoseIndia Team
* Date:-25-Jun-2008
*/
import java.net.*;
public class UsingProxy {
public static void main(String[] args) throws Exception {
URL url = new URL("http://192.168.10.211:8080");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
System.out.println("connection is going through a proxy: "
+ connection.usingProxy());
}
} |
Output of the program:-
| connection is going through a proxy: false |
|