code: @Override
      protected SessionState getState(NioSessionEx session) {
          SelectionKey key = session.getSelectionKey();
  
          if (key == null) {
              // The channel is not yet registered to a selector
              return SessionState.OPENING;
          }
  
          if (key.isValid()) {
              // The session is opened
              return SessionState.OPENED;
          } else {
              // The session still as to be closed
              return SessionState.CLOSING;
          }
      }
docs: {@inheritDoc}