title: Android java.net.UnknownHostException: Host is unresolved: server_address:443
body: <p>I'm trying to get xml from server via https connection. If i do it with curl command</p>
  
  <pre><code>curl -k -A "Mozilla/4.0" https://username:password@server.com/test/infoxml.ashx
  </code></pre>
  
  <p>connection is successfull, but when i try it in java on android, it doesn't work. I'm using this code:</p>
  
  <pre><code>URL url = new URL("https://user:password@server.com");
  HttpsURLConnection conn = (HttpsURLConnection)url.openConnection();
  conn.setRequestMethod("GET");
  conn.setRequestProperty("Authorization", "Basic **********************");
  conn.setRequestProperty("User-Agent", "Mozilla/4.0");
  conn.setRequestProperty("Host", "server.com");
  conn.setRequestProperty("Accept", "*/*");
  
  InputStream content = conn.getInputStream();
  </code></pre>
  
  <p>As you can see, I set up headers based on verbose output of working curl command, which is as follows:</p>
  
  <pre><code>* About to connect() to server.com port 443 (#0)
  *   Trying (server ip)... connected
  * Connected to server.com (server ip) port 443 (#0)
  * SSLv3, TLS handshake, Client hello (1):
  * SSLv3, TLS handshake, Server hello (2):
  * SSLv3, TLS handshake, CERT (11):
  * SSLv3, TLS handshake, Server finished (14):
  * SSLv3, TLS handshake, Client key exchange (16):
  * SSLv3, TLS change cipher, Client hello (1):
  * SSLv3, TLS handshake, Finished (20):
  * SSLv3, TLS change cipher, Client hello (1):
  * SSLv3, TLS handshake, Finished (20):
  * SSL connection using AES256-SHA
  * Server certificate:
  *   subject: C=SI; ST=City; L=City; O=Company d.d; OU=ES; CN=server.com
  *   start date: 2010-02-05 00:00:00 GMT
  *   expire date: 2011-02-02 23:59:59 GMT
  *   common name: server.com (matched)
  *   issuer: C=ZA; ST=Western Cape; L=Cape Town; O=Thawte Consulting cc; OU=Certification Services Division; CN=Thawte Premium Server CA; emailAddress=censored
  *   SSL certificate verify ok.
  * Server auth using Basic with user 'username'
  &gt; GET /test/infoxml.ashx HTTP/1.1
  &gt; Authorization: Basic ****************************
  &gt; User-Agent: Mozilla/4.0
  &gt; Host: server.com
  &gt; Accept: */*
  &gt; 
  &lt; HTTP/1.1 200 OK
  &lt; Connection: Keep-Alive
  &lt; X-Powered-By: ASP.NET
  &lt; X-AspNet-Version: 2.0.50727
  &lt; Keep-Alive: timeout=5, max=100
  &lt; Server: Microsoft-IIS/6.0
  &lt; Cache-Control: private
  &lt; Set-Cookie: JSESSIONID=abcs8ebwPsf-A-biM7KTs; path=/
  &lt; Content-Type: text/xml; charset=utf-8
  &lt; Content-Length: 1688
  &lt; Date: Thu, 30 Sep 2010 23:16:06 GMT
  &lt; 
  * Connection #0 to host server.com left intact
  * Closing connection #0
  * SSLv3, TLS alert, Client hello (1):
  &lt;?xml version="1.0"...
  </code></pre>
  
  <p>I'm new to this secure connection stuff, so go easy on me :)</p>
  
  <p>p.s. sorry for my bad English.</p>