title: Using nv-websocket-client on Android
body: <p>I am testing nv-websocket-client on Android using Android Studio 2.2.3/JRE1.8.0_76.</p>
  
  <p>My code is basically the same as the echo sample application in the README.md file.  The class runs fine under Java 8 Update 111, but fails under Android Studio.  I walked the code in debug mode and it failed at:</p>
  
  <p>Source:com/neovisionaries/ws/client/Address.java:36</p>
  
  <pre><code>InetSocketAddress toInetSocketAddress()
  {
      return new InetSocketAddress(mHost, mPort);// mHost = "echo.websocket.org", mPort = 80.
  }
  </code></pre>
  
  <p>Error message in Android Studio: </p>
  
  <pre><code>Method threw 'java.lang.NullPointerException' exception. Cannot evaluate java.net.InetSocketAddress.toString()
  </code></pre>
  
  <p>Any idea what I did wrong here?    </p>
  
  <p>My Test Class:</p>
  
  <pre><code>public class TestWS {
  
  private String m_msg;
  private String m_uriStr; // = "ws://echo.websocket.org";
  private static final int TIMEOUT = 5000;
  
  public TestWS(String uriStr) {
      m_uriStr = uriStr;
      m_msg = "";
  }
  
  public void RunTest() {
      try {
          // Connect to the echo server.
          WebSocket ws = connect();
          ws.sendText("This is a test");
          Thread.sleep(1000); // Make sure m_msg is updated before function return.
          ws.disconnect();
      }
      catch(Exception ex)
      {
          m_msg += "Exception: " + ex.getMessage(); // getMessage() returns null.
      }
  }
  
  private WebSocket connect() throws IOException, WebSocketException
  {
      return new WebSocketFactory()
              .setConnectionTimeout(TIMEOUT)
              .createSocket(m_uriStr)
              .addListener(new WebSocketAdapter() {
                  // A text message arrived from the server.
                  @Override
                  public void onTextMessage(WebSocket websocket, String message) {
                      m_msg += "Echo: " + message;
                  }
              })
              .addExtension(WebSocketExtension.PERMESSAGE_DEFLATE)
              .connect(); // &lt;= failed in this function.
  }
  
  public String GetMsg(){
      return m_msg;
  }
  }
  </code></pre>