void sendSessionMessages() {

      ClientSessionHandler handler = handlers.get(sessionRefId);
      /*
       * If a local handler exists, forward messages to local
       * handler to send to client session; otherwise log
       * error message.
       */
      if (handler != null && handler.isConnected()) {
        if (sendLoginResult) {
          if (loginSuccess) {
            handler.loginSuccess();
          } else {
            handler.loginFailure(loginException);
            return;
          }
        }
        SessionProtocol protocol = handler.getSessionProtocol();
        if (protocol != null) {
          for (SendEvent sendEvent : messages) {
            try {
              protocol.sessionMessage(ByteBuffer.wrap(sendEvent.message), sendEvent.delivery);
            } catch (Exception e) {
              logger.logThrow(Level.WARNING, e, "sessionMessage throws");
            }
          }
        }
      } else {
        logger.log(Level.FINE, "Discarding messages for disconnected session:{0}", handler);
      }
    }
    void sendMessages() {

      ClientSessionHandler handler = handlers.get(sessionRefId);
      /*
       * If a local handler exists, forward messages to local
       * handler to send to client session; otherwise log
       * error message.
       */
      if (handler != null && handler.isConnected()) {
        if (loginAck != null) {
          handler.sendLoginProtocolMessage(loginAck, Delivery.RELIABLE);
        }
        for (byte[] message : messages) {
          handler.sendProtocolMessage(message, Delivery.RELIABLE);
        }
      } else {
        logger.log(Level.FINE, "Discarding messages for disconnected session:{0}", handler);
      }
    }