/**
  * Invoked when the idle status of a session changes.
  *
  * @param session The session in question
  * @param status The new idle status
  */
 public void sessionIdle(IoSession session, IdleStatus status) {
   Player player = (Player) session.getAttachment();
   if (!player.destroyed()) {
     player.destroy(false);
   }
   session.close();
 }
 public void stop() {
   for (IoSession session : sessions) {
     if (session != null) {
       session.close();
     }
   }
 }
 @Override
 public void sessionCreated(NextFilter nextFilter, IoSession session) throws Exception {
   if (!isConnectionOk(session)) {
     session.close();
     return;
   }
   nextFilter.sessionCreated(session);
 }
 protected void closeSession() {
   logger.warn("Closing session");
   session.close();
 }
  /**
   * Invoked whenever an exception is thrown by MINA or this IoHandler.
   *
   * @param session The associated session
   * @param cause The exception thrown
   */
  public void exceptionCaught(IoSession session, Throwable cause) {
    Player p = (Player) session.getAttachment();

    if (p != null) p.getActionSender().sendLogout();
    session.close();
  }
 public void disconnect() {
   if (session != null) {
     session.close().join(30);
     session = null;
   }
 }