code: public static byte[] calculateHmacSha1(byte[] message, int offset, int length, byte[] key) throws IllegalArgumentException {
  		try {
  			// get an HMAC-SHA1 key from the raw key bytes
  			SecretKeySpec signingKey = new SecretKeySpec(key, HMAC_SHA1_ALGORITHM);
  
  			// get an HMAC-SHA1 Mac instance and initialize it with the key
  			Mac mac = Mac.getInstance(HMAC_SHA1_ALGORITHM);
  			mac.init(signingKey);
  
  			// compute the hmac on input data bytes
  			byte[] macInput = new byte[length];
  			System.arraycopy(message, offset, macInput, 0, length);
  			return mac.doFinal(macInput);
  		} catch (Exception exc) {
  			throw new IllegalArgumentException("Could not create HMAC-SHA1 request encoding", exc);
  		}
  	}
docs: Encodes <tt>message</tt> using <tt>key</tt> and the HMAC-SHA1 algorithm
  as per RFC 2104 and returns the resulting byte array. This is a utility
  method that generates content for the {@link MessageIntegrityAttribute}
  regardless of the credentials being used (short or long term).
  
  @param message
  the STUN message that the resulting content will need to
  travel in.
  @param offset
  the index where data starts in <tt>message</tt>.
  @param length
  the length of the data in <tt>message</tt> that the method
  should consider.
  @param key
  the key that we should be using for the encoding (which
  depends on whether we are using short or long term
  credentials).
  
  @return the HMAC that should be used in a
  <tt>MessageIntegrityAttribute</tt> transported by
  <tt>message</tt>.
  
  @throws IllegalArgumentException
  if the encoding fails for some reason.