private void writeReset(final InetSocketAddress remoteEndpoint, final int messageID) {
    try {
      CoapMessage resetMessage = CoapMessage.createEmptyReset(messageID);
      ChannelFuture future = Channels.future(ctx.getChannel());

      Channels.write(this.getChannelHandlerContext(), future, resetMessage, remoteEndpoint);

      future.addListener(
          new ChannelFutureListener() {
            @Override
            public void operationComplete(ChannelFuture future) throws Exception {
              log.info("RST for message ID {} succesfully sent to {}.", messageID, remoteEndpoint);
            }
          });
    } catch (IllegalArgumentException e) {
      log.error("This should never happen.", e);
    }
  }
  private void writeEmptyAcknowledgement(
      final InetSocketAddress remoteAddress, final int messageID) {
    try {
      CoapMessage emptyAcknowledgement = CoapMessage.createEmptyAcknowledgement(messageID);

      ChannelFuture future = Channels.future(ctx.getChannel());
      Channels.write(ctx, future, emptyAcknowledgement, remoteAddress);

      future.addListener(
          new ChannelFutureListener() {
            @Override
            public void operationComplete(ChannelFuture future) throws Exception {
              log.info(
                  "Empty ACK for message ID {} succesfully sent to {}.", messageID, remoteAddress);
            }
          });
    } catch (IllegalArgumentException e) {
      log.error("This should never happen.", e);
    }
  }