I\'m using the following code to open a http connection in java:
URL url = new URL(\"http://stackoverflow.com\");
HttpURLConnection conn = (HttpURLConnecti
The Host header is filled by the HttpURLConnection based on the URL. You can't open foo.com with Host=bar.com. From the RFC
The Host request-header field specifies the Internet host and port number of the resource being requested, as obtained from the original URI given by the user or referring resource (generally an HTTP URL)
Btw, you can also try apache http components.