code: public static void ping(GSSCredential cred, String resourceManagerContact)
  	throws GramException, GSSException {
  
  	ResourceManagerContact rmc =
  	    new ResourceManagerContact(resourceManagerContact);
  	Socket socket = gatekeeperConnect(cred, rmc, false, false);
  
  	HttpResponse hd = null;
  
  	try {
  	    OutputStream out = socket.getOutputStream();
  	    InputStream in   = socket.getInputStream();
  
  	    String msg = GRAMProtocol.PING(rmc.getServiceName(),
  					   rmc.getHostName());
  
  	    // send message
  	    out.write(msg.getBytes());
  	    out.flush();
  
  	    debug("PG SENT:", msg);
  
  	    // receive reply
  	    hd = new HttpResponse(in);
  
  	} catch(IOException e) {
  	    throw new GramException(GramException.ERROR_PROTOCOL_FAILED, e);
  	} finally {
  	    try { socket.close(); } catch (Exception e) {}
  	}
  
  	debug("PG RECEIVED:", hd);
  
  	checkHttpReply(hd.httpCode);
      }
docs: Performs ping operation on the gatekeeper with
  specified user credentials.
  Verifies if the user is authorized to submit a job
  to that gatekeeper.
  
  @throws GramException if an error occurs or user in unauthorized
  @param cred user credentials
  @param resourceManagerContact resource manager contact