code: byte[] initSecContext(byte[] inputBuf, int offset, int len) throws GSSException {
          byte[] ret = null;
          if(len == 0){
              byte[] mechToken = context.initSecContext(inputBuf, offset, len);
              int contextFlags = 0;
              if (context.getCredDelegState()) {
                  contextFlags |= NegTokenInit.DELEGATION;
              }
              if (context.getMutualAuthState()) {
                  contextFlags |= NegTokenInit.MUTUAL_AUTHENTICATION;
              }
              if (context.getReplayDetState()) {
                  contextFlags |= NegTokenInit.REPLAY_DETECTION;
              }
              if (context.getSequenceDetState()) {
                  contextFlags |= NegTokenInit.SEQUENCE_CHECKING;
              }
              if (context.getAnonymityState()) {
                  contextFlags |= NegTokenInit.ANONYMITY;
              }
              if (context.getConfState()) {
                  contextFlags |= NegTokenInit.CONFIDENTIALITY;
              }
              if (context.getIntegState()) {
                  contextFlags |= NegTokenInit.INTEGRITY;
              }
              ret = new NegTokenInit(new String[]{context.getMech().toString()}, contextFlags, mechToken, null).toByteArray();
          }else{
              SpnegoToken spToken = getToken(inputBuf, offset, len);
              byte[] mechToken = spToken.getMechanismToken();
              mechToken = context.initSecContext(
                      mechToken, 
                          0, mechToken.length);
              if(mechToken!=null){
                  int result = NegTokenTarg.ACCEPT_INCOMPLETE;
                  if(context.isEstablished()){
                      result = NegTokenTarg.ACCEPT_COMPLETED;
                  }
                  ret = new NegTokenTarg(result, context.getMech().toString(), mechToken, null).toByteArray();
              }
          }
          return ret;
      }
docs: Initialize the GSSContext to provide SPNEGO feature.
  
  @param inputBuf
  @param offset
  @param len
  @return
  @throws GSSException