示例#1
0
 /**
  * Creates a new STUN <tt>Message</tt> to be sent to the STUN server associated with the
  * <tt>StunCandidateHarvester</tt> of this instance in order to keep a specific
  * <tt>LocalCandidate</tt> (harvested by this instance) alive.
  *
  * @param candidate the <tt>LocalCandidate</tt> (harvested by this instance) to create a new
  *     keep-alive STUN message for
  * @return a new keep-alive STUN <tt>Message</tt> for the specified <tt>candidate</tt> or
  *     <tt>null</tt> if no keep-alive sending is to occur
  * @throws StunException if anything goes wrong while creating the new keep-alive STUN
  *     <tt>Message</tt> for the specified <tt>candidate</tt> or the candidate is of an unsupported
  *     <tt>CandidateType</tt>
  */
 protected Message createKeepAliveMessage(LocalCandidate candidate) throws StunException {
   /*
    * We'll not be keeping a STUN Binding alive for now. If we decide to in
    * the future, we'll have to create a Binding Indication and add support
    * for sending it.
    */
   if (CandidateType.SERVER_REFLEXIVE_CANDIDATE.equals(candidate.getType())) return null;
   else {
     throw new StunException(StunException.ILLEGAL_ARGUMENT, "candidate");
   }
 }