title: Android Socket Host is unresolved *.onion
body: <p>I try to implement socket connection to hidden service into TOR network. I have onion domain hostname of it hidden service. I have Orbot installed on device. I create socket for connect to hidden service using proxy Orbot. I did it this way:</p>
  
  <pre><code>Proxy proxy = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress(
              "localhost", 9050));
      clientSocket = new Socket(proxy);
  
      InetSocketAddress remoteAddress = InetSocketAddress.createUnresolved(HS_DOMEN, HS_PORT);
  
      if (remoteAddress.isUnresolved())
          Log.i("LOG", "address unresolved!!!");
  
      Log.i("LOG", "start connect to inet addr");
      clientSocket.connect(remoteAddress, CONNECT_TIMEOUNT);
      Log.i("LOG", "after connect ward");
  
      if (clientSocket.isConnected()) {
          Log.i("LOG", "socket connected");
      }
  </code></pre>
  
  <p>Socket successful understand proxy setttings, but when I try to connect to hidden service error occurs:</p>
  
  <pre><code>11-06 14:34:57.215: W/System.err(32101): java.net.UnknownHostException: Host is 
  unresolved: *.onion
  11-06 14:34:57.215: W/System.err(32101):    at java.net.Socket.connect(Socket.java:825)
  11-06 14:34:57.215: W/System.err(32101):    at ru.dtlbox.example.clientsample.MainActivity.connectSocket(MainActivity.java:79)
  11-06 14:34:57.215: W/System.err(32101):    at ru.dtlbox.example.clientsample.MainActivity$2.run(MainActivity.java:128)
  11-06 14:34:57.215: W/System.err(32101):    at java.lang.Thread.run(Thread.java:856)
  </code></pre>
  
  <p>Onion host name is valid, because I tried to test it using Orweb, everything works fine. There is nginx server on 80 port. But my Socket can't resolve this onion address. I think it  occurs because InetAddress class can't resolve IP address for passed hostname. But how can I setup right settings mayby or use different way to connect? Is there any idea? Thank a lot!</p>