/** * Creates a new <tt>Request</tt> instance which is to be sent by this * <tt>StunCandidateHarvest</tt> in order to retry a specific <tt>Request</tt>. For example, the * long-term credential mechanism dictates that a <tt>Request</tt> is first sent by the client * without any credential-related attributes, then it gets challenged by the server and the client * retries the original <tt>Request</tt> with the appropriate credential-related attributes in * response. * * @param request the <tt>Request</tt> which is to be retried by this * <tt>StunCandidateHarvest</tt> * @return the new <tt>Request</tt> instance which is to be sent by this * <tt>StunCandidateHarvest</tt> in order to retry the specified <tt>request</tt> */ protected Request createRequestToRetry(Request request) { switch (request.getMessageType()) { case Message.BINDING_REQUEST: return MessageFactory.createBindingRequest(); default: throw new IllegalArgumentException("request.messageType"); } }
/** * Creates a new <tt>Request</tt> which is to be sent to {@link StunCandidateHarvester#stunServer} * in order to start resolving {@link #hostCandidate}. * * @return a new <tt>Request</tt> which is to be sent to {@link StunCandidateHarvester#stunServer} * in order to start resolving {@link #hostCandidate} */ protected Request createRequestToStartResolvingCandidate() { return MessageFactory.createBindingRequest(); }