code: @Function
      public static GSSContext createClientGSSContext(String server) {
          try {
              GSSManager manager = GSSManager.getInstance();
              GSSName serverName = manager.createName(server, null);
  
              GSSContext context = manager.createContext(serverName,
                      krb5Oid,
                      null,
                      GSSContext.DEFAULT_LIFETIME);
  
              context.requestMutualAuth(true);  // Mutual authentication
              context.requestConf(true);  // Will use encryption later
              context.requestInteg(true); // Will use integrity later
  
              return context;
          } catch (GSSException ex) {
              throw new RuntimeException("Exception creating client GSSContext", ex);
          }
      }
docs: Create a GSS Context from a clients point of view.
  @param server the name of the host for which the GSS Context is being created
  @return the GSS Context that a client can use to exchange security tokens for
  a secure channel, then wrap()/unpack() messages.