@Override public boolean handleInboundCoapMessage( CoapMessage coapMessage, final InetSocketAddress remoteSocket) { LOG.debug("HANDLE INBOUND MESSAGE: {}", coapMessage); if (coapMessage instanceof CoapResponse) { return handleInboundCoapResponse((CoapResponse) coapMessage, remoteSocket); } else if (coapMessage.isPing()) { LOG.debug( "Received PING from \"{}\" (Message ID: {}).", remoteSocket, coapMessage.getMessageID()); sendReset(coapMessage.getMessageID(), remoteSocket); return false; } else { return true; } }
@Override public boolean handleOutboundCoapMessage( CoapMessage coapMessage, InetSocketAddress remoteSocket) { if (coapMessage instanceof CoapRequest) { addToAwaitedResponses(remoteSocket, coapMessage.getToken()); LOG.debug("Exchanges: {}", this.awaitedResponses.size()); } return true; }