private BindingErrorResponse createErrorResponse( final BindingRequest request) { // We need to send a Binding Error Response with a // 487 Role Conflict ERROR CODE attribute. final UUID transactionId = request.getTransactionId(); final BindingErrorResponse errorResponse = new BindingErrorResponse(transactionId, 487, "Role Conflict"); return errorResponse; }
public String toString() { return getClass().getSimpleName()+" with attributes: "+getAttributes(); } }
/** * Creates a new binding response message. * * @param transactionId The ID of the transaction. * @param errorCode The code for the error. * @param reasonPhrase The reason description. */ public BindingErrorResponse(final UUID transactionId, final int errorCode, final String reasonPhrase) { super(transactionId, StunMessageType.BINDING_ERROR_RESPONSE, createAttributes(errorCode, reasonPhrase)); }
final int errorCode = bindingErrorResponse.getErrorCode(); bindingErrorResponse.getAttributes()); m_pair.setState(IceCandidatePairState.FAILED); return null;
return new BindingSuccessResponse(id, attributes); case BINDING_ERROR_RESPONSE: return new BindingErrorResponse(id, attributes); case ALLOCATE_REQUEST: return new AllocateRequest(id);
/** * Returns the full error code. * * @return The full error code, including the class and the number. */ public int getErrorCode() { final Map<StunAttributeType, StunAttribute> attributes = getAttributes(); final ErrorCodeAttribute errorAttribute = (ErrorCodeAttribute) attributes.get(StunAttributeType.ERROR_CODE); return errorAttribute.getErrorCode(); }
private static Map<StunAttributeType, StunAttribute> createAttributes( final int errorCode, final String reasonPhrase) { final StunAttribute error = new ErrorCodeAttribute(errorCode, reasonPhrase); return createAttributes(error); }