@Override
 public void run() {
   WebSocketImpl ws = null;
   try {
     while (true) {
       ByteBuffer buf = null;
       ws = iqueue.take();
       buf = ws.in.poll();
       assert (buf != null);
       try {
         ws.decode(buf);
         // ws.flush();
       } catch (IOException e) {
         handleIOException(ws, e);
       } finally {
         pushBuffer(buf);
       }
     }
   } catch (RuntimeException e) {
     handleFatal(ws, e);
   } catch (InterruptedException e) {
   } catch (Throwable e) {
     e.printStackTrace();
   }
 }
 @Override
 public void run() {
   WebSocketImpl ws = null;
   try {
     while (true) {
       ByteBuffer buf = null;
       ws = iqueue.take();
       buf = ws.inQueue.poll();
       assert (buf != null);
       try {
         ws.decode(buf);
       } catch (Exception e) {
         System.err.println("Error while reading from remote connection: " + e);
       } finally {
         pushBuffer(buf);
       }
     }
   } catch (InterruptedException e) {
   } catch (RuntimeException e) {
     handleFatal(ws, e);
   }
 }