private void reject(final Message message) { EmptyMessage rst = EmptyMessage.newRST(message); coapstack.sendEmptyMessage(null, rst); }
/** * Reject this exchange and therefore the request. Sends an RST back to the * client. */ public void sendReject() { assert (origin == Origin.REMOTE); request.setRejected(true); EmptyMessage rst = EmptyMessage.newRST(request); endpoint.sendEmptyMessage(this, rst); }
/** * Reject this exchange and therefore the request. Sends an RST back to the * client. */ public void sendReject() { assert (origin == Origin.REMOTE); request.setRejected(true); EmptyMessage rst = EmptyMessage.newRST(request); endpoint.sendEmptyMessage(this, rst); }
/** * Rejects a given message. * <p> * The message is rejected by sending an empty message of type RST echoing * the message's MID. * * @param exchange The exchange the message is part of or {@code null} if * the message has been received out of the scope of an exchange. * @param message The message to reject. * @throws IllegalArgumentException if the message is of type ACK or RST. */ public final void reject(final Exchange exchange, final Message message) { if (message.getType() == Type.ACK || message.getType() == Type.RST) { throw new IllegalArgumentException("Can only reject CON/NON messages"); } else { lower().sendEmptyMessage(exchange, EmptyMessage.newRST(message)); } }
/** * Reject the specified message. Rejecting an ACK or RST is not allowed. * * @param exchange the exchange, can be null * @param message the message * @throws IllegalArgumentException if the message's type is ACK or RST */ public void reject(Exchange exchange, Message message) { /* * From core-coap draft 14: * More generally, Acknowledgement and Reset messages MUST NOT elicit * any Acknowledgement or Reset message from their recipient. (draft-14) */ if (message.getType() == Type.ACK || message.getType() == Type.RST) throw new IllegalArgumentException("Rejecting an "+message.getType()+" is not allowed"); sendEmptyMessage(exchange, EmptyMessage.newRST(message)); }
@Override public void receiveResponse(Exchange exchange, Response response) { if (response.getOptions().hasObserve() && exchange.getRequest().isCanceled()) { // The request was canceled and we no longer want notifications LOGGER.finer("Rejecting notification for canceled Exchange"); EmptyMessage rst = EmptyMessage.newRST(response); sendEmptyMessage(exchange, rst); // Matcher sets exchange as complete when RST is sent } else { // No observe option in response => always deliver super.receiveResponse(exchange, response); } }
@Override public void receiveResponse(final Exchange exchange, final Response response) { if (response.getOptions().hasObserve() && exchange.getRequest().isCanceled()) { // The request was canceled and we no longer want notifications LOGGER.finer("Rejecting notification for canceled Exchange"); EmptyMessage rst = EmptyMessage.newRST(response); sendEmptyMessage(exchange, rst); // Matcher sets exchange as complete when RST is sent } else { // No observe option in response => always deliver upper().receiveResponse(exchange, response); } }
private void reject(Message message) { EmptyMessage rst = EmptyMessage.newRST(message); // sending directly through connector, not stack, thus set token rst.setToken(new byte[0]); for (MessageInterceptor interceptor:interceptors) interceptor.sendEmptyMessage(rst); // MessageInterceptor might have canceled if (!rst.isCanceled()) connector.send(serializer.serialize(rst)); }
EmptyMessage rst = EmptyMessage.newRST(request); sendEmptyMessage(exchange, rst);
EmptyMessage rst = EmptyMessage.newRST(request); sendEmptyMessage(exchange, rst);
EmptyMessage rst = EmptyMessage.newRST(response); sendEmptyMessage(exchange, rst);
new Object[]{responseStatus.getCurrentNum(), block2.getNum(), response}); if (response.getType()==Type.CON) { EmptyMessage rst = EmptyMessage.newRST(response); lower().sendEmptyMessage(exchange, rst);