Exemplo n.º 1
0
 /**
  * Stop WebSocket Server
  *
  * @throws Exception
  */
 public static synchronized void stopServer() throws Exception {
   if (sInstance == null) {
     return;
   }
   sInstance.setListener(null);
   sInstance.stop();
   sInstance = null;
 }
Exemplo n.º 2
0
  /**
   * Start a new Server
   *
   * @param port
   * @return
   */
  public static synchronized ExWebSocketServer startNewServer(int port, ClientListener listener)
      throws Exception {

    if (sInstance == null) {

      // Don't have a WebSocket Server running...
      sInstance = new ExWebSocketServer(new InetSocketAddress(port));
      sInstance.setListener(listener);
      sInstance.start();
    }
    return sInstance;
  }