code: private static GatekeeperReply renewDelegationHandshake(
                                                  ExtendedGSSContext context,
                                                  GSSCredential newCred,
                                                  GSIGssOutputStream out,
                                                  GSIGssInputStream in)
          throws GSSException, IOException {
          byte [] input = new byte[0];
          byte [] output = null;
  
          do {
              output = produceRenewToken(context, context.initDelegation(
                                                      newCred, null, 0, input,
                                                      0, input.length));
              out.writeToken(output);
              if (!context.isDelegationFinished()) {
                  input = consumeRenewToken(context, in.readHandshakeToken());
              }
          } while (!context.isDelegationFinished());
          GatekeeperReply reply = new GatekeeperReply(in);
          return reply;
      }
docs: Completes a GSI delegation handshake with a globus job manager
  that has agreed to a (previously sent) GRAM "renew" request.  After
  the job manager receives the last token in the handshake, it responds
  with a message following the GRAM protocol indicating delegation success
  or failure.
  
  @param context Previously established context with job manager
  @param newCred The credential used to generate a new delegated proxy
  @param out Stream used to send messages to job manager
  @param in Stream used to receive messages from job manager
  @throws GSSException if an error occurs during token wrapping/unwrapping
  @throws IOException if a communication error occurs
  @return the GRAM response message indicating delegation status