what is 'proxy.mycompany1.local'
<p>I just started working in Java networking protocols. I am trying to connect to the internet using my proxy server. When I see the post at '<a href="https://www.tutorialspoint.com/javaexamples/net_poxy.htm">https://www.tutorialspoint.com/javaexamples/net_poxy.htm</a>', they set the http.proxyHost property to 'proxy.mycompany1.local'. I know I can set this to my proxy server IP, but I am curious to know why my program still works, even though I set it to some random string like "abcd".</p>

<p>A. What does 'proxy.mycompany1.local" stand for?</p>

<p>B. How come my program works, even though I set the http.proxyHost" to "abcd"?</p>

<p>Following is my working program:</p>

<pre><code>import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.ProxySelector;
import java.net.URI;
import java.net.URL;

public class TestProxy {
    public static void main(String s[]) throws Exception {
        try {

            System.setProperty("http.proxyHost", "abcd");
            System.setProperty("http.proxyPort", "8080");

            URL u = new URL("http://www.google.com");
            HttpURLConnection con = (HttpURLConnection) u.openConnection();
            System.out.println(con.getResponseCode() + " : " + con.getResponseMessage());

        } catch (Exception e) {
            e.printStackTrace();
            System.out.println(false);
        }
        Proxy proxy = (Proxy) ProxySelector.getDefault().select(new URI("http://www.google.com")).iterator().next();
        System.out.println("proxy Type : " + proxy.type());
        InetSocketAddress addr = (InetSocketAddress) proxy.address();
        if (addr == null) {
            System.out.println("No Proxy");
        } else {
            System.out.println("proxy hostname : " + addr.getHostName());
            System.out.println("proxy port : " + addr.getPort());
        }
    }
}
</code></pre>

<p>This is the output:</p>

<pre><code>200 : OK
proxy Type : HTTP
proxy hostname : abcd
proxy port : 8080
</code></pre>