title: What is a simple way to implement a websocket client in Android? Is the following example correct?
body: <p>I was trying to use a class that implements a WebSocket client in Android. But I get the following error: </p>
  
  <pre><code>12-07 11:22:46.286 31579-31579/com.domain.wsocketchat W/System: ClassLoader referenced unknown path: /data/app/com.domain.wsocketchat-2/lib/arm
  12-07 11:22:46.392 31579-31579/com.domain.wsocketchat W/System.err: an error occurred:java.net.SocketException: socket failed: EACCES (Permission denied)
  </code></pre>
  
  <p>The class that I'm using follows: </p>
  
  <pre><code>import org.java_websocket.client.WebSocketClient;
  import org.java_websocket.drafts.Draft;
  import org.java_websocket.drafts.Draft_10;
  import org.java_websocket.handshake.ServerHandshake;
  
  import java.net.URI;
  
  public class EmptyClient extends WebSocketClient {
      public EmptyClient(URI serverUri, Draft draft) {
          super(serverUri, draft);
      }
  
      public EmptyClient(URI serverURI) {
          super(serverURI);
      }
  
      @Override
      public void onOpen(ServerHandshake handshakedata) {
          System.out.println("new connection opened");
      }
  
      @Override
      public void onClose(int code, String reason, boolean remote) {
          System.out.println("closed with exit code " + code + " additional info: " + reason);
      }
  
      @Override
      public void onMessage(String message) {
          System.out.println("received message: " + message);
      }
  
      @Override
      public void onError(Exception ex) {
          System.err.println("an error occurred:" + ex);
      }
  }
  </code></pre>
  
  <p>The class is called within the <strong>onCreate()</strong>:</p>
  
  <pre><code>WebSocketClient client = null;
  try {
      client = new EmptyClient(new URI("ws://192.168.1.135:9000/server.php"), new Draft_10());
  } catch (URISyntaxException e) {
      e.printStackTrace();
  }
  client.connect();
  </code></pre>
  
  <p><strong>AndroidManifest:</strong> </p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt;
  </code></pre>
  
  <p><strong>Sdk:</strong> minSdkVersion 16</p>
  
  <p>Anyone have any idea, what could be the problem? It seems everything allright!
  Thank you in advance.</p>