code: private HandshakeStatus getHSStatus(HandshakeStatus hss) {
  
          if (hss != null) {
              return hss;
          }
  
          synchronized (this) {
              if (writer.hasOutboundData()) {
                  return HandshakeStatus.NEED_WRAP;
              } else if (handshaker != null) {
                  if (handshaker.taskOutstanding()) {
                      return HandshakeStatus.NEED_TASK;
                  } else {
                      return HandshakeStatus.NEED_UNWRAP;
                  }
              } else if (connectionState == cs_CLOSED) {
                  /*
                   * Special case where we're closing, but
                   * still need the close_notify before we
                   * can officially be closed.
                   *
                   * Note isOutboundDone is taken care of by
                   * hasOutboundData() above.
                   */
                  if (!isInboundDone()) {
                      return HandshakeStatus.NEED_UNWRAP;
                  } // else not handshaking
              }
  
              return HandshakeStatus.NOT_HANDSHAKING;
          }
      }
docs: /*
  Report the current status of the Handshaker