title: WebSocket Secure java.nio.channels.UnresolvedAddressException
body: <p>I faced with the problem using WebSocket Secure. I using this websocket library: 'org.java-websocket:Java-WebSocket:1.3.0'. The problem appears only on LENOVO smartphones (not at all models, for example Lenovo A6000 works as expected). For example error occurs on Lenovo Vibe devices. I tested it on Nexus 4, Nexus 5, Nexus 5x, Nexus 6, Nexus 6P, Lenovo A6000, Lenovo Vibe, Samsung Galaxy SIII (CyanogenMod Android 4.4.4). Error appeared only on Lenovo Vibe devices from this list. 
  Here is an error:</p>
  
  <pre><code>java.nio.channels.UnresolvedAddressException
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>    final String url =  wss://*****.com/wss;
      URI uri=null;
      try{
          uri = new URI(url);
      }
      catch (Exception e)
      {
      }
      Map&lt;String, String&gt; headers = new HashMap&lt;&gt;();
      headers.put("auth_key", TOKEN);
      mWebSocketClient = new WebSocketClient(uri, new Draft_10(), headers, 0) {
          @Override
          public void onOpen(ServerHandshake handshakedata) {
  
          }
          @Override
          public void onMessage(String message) {
  
          }
  
          @Override
          public void onClose(int code, String reason, boolean remote) {
  
          }
  
          @Override
          public void onError(Exception ex) {
              //HERE I HANDLE AN ERROR ON LENOVO VIBE
          }
      };
      try{
          SSLContext sslContext = SSLContext.getDefault();
          mWebSocketClient.setWebSocketFactory(new DefaultSSLWebSocketClientFactory(sslContext));
          mWebSocketClient.connect();
      }catch (Exception e)
      {
      }
  </code></pre>
  
  <p>Error occurs inside the library, in WebSocketClient.java class here:</p>
  
  <pre><code>private final void interruptableRun() {
      if( channel == null ) {
          return;// channel will be initialized in the constructor and only be null if no socket channel could be created or if blocking mode could be established
      }
  
      try {
          String host;
          int port ;
  
          if( proxyAddress != null ) {
              host = proxyAddress.getHostName();
              port = proxyAddress.getPort();
          } else {
              host = uri.getHost();
              port = getPort();
          }
          channel.connect( new InetSocketAddress( host, port ) );
          conn.channel = wrappedchannel = createProxyChannel( wsfactory.wrapChannel( channel, null, host, port ) );
  
          timeout = 0; // since connect is over
          sendHandshake();
          readthread = new Thread( new WebsocketWriteThread() );
          readthread.start();
      } catch ( ClosedByInterruptException e ) {
          onWebsocketError( null, e );
          return;
      } catch ( /*IOException | SecurityException | UnresolvedAddressException*/Exception e ) {//
          onWebsocketError( conn, e );
          conn.closeConnection( CloseFrame.NEVER_CONNECTED, e.getMessage() );
          return;
      }
  
      ByteBuffer buff = ByteBuffer.allocate( WebSocketImpl.RCVBUF );
      try/*IO*/{
          while ( channel.isOpen() ) {
              if( SocketChannelIOHelper.read( buff, this.conn, wrappedchannel ) ) {
                  conn.decode( buff );
              } else {
                  conn.eot();
              }
  
              if( wrappedchannel instanceof WrappedByteChannel ) {
                  WrappedByteChannel w = (WrappedByteChannel) wrappedchannel;
                  if( w.isNeedRead() ) {
                      while ( SocketChannelIOHelper.readMore( buff, conn, w ) ) {
                          conn.decode( buff );
                      }
                      conn.decode( buff );
                  }
              }
          }
  
      } catch ( CancelledKeyException e ) {
          conn.eot();
      } catch ( IOException e ) {
          conn.eot();
      } catch ( RuntimeException e ) {
          // this catch case covers internal errors only and indicates a bug in this websocket implementation
          onError( e );
          conn.closeConnection( CloseFrame.ABNORMAL_CLOSE, e.getMessage() );
      }
  }
  </code></pre>
  
  <p>On This Line:</p>
  
  <pre><code>channel.connect( new InetSocketAddress( host, port ) );
  </code></pre>
  
  <p><strong>Also, if you know any other WebSocket library that properly working on all devices, where i can use wss links and put custom headers, please share.</strong></p>