@Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        NetworkMessage networkMessage = (NetworkMessage) msg;
        Object originalMessage = networkMessage.getMessage();
        ctx.writeAndFlush(new AcknowledgementHandler.EventReceived());
        try {
            Object decodedMessage = decode(ctx.channel(), networkMessage.getRemoteAddress(), originalMessage);
            onMessageEvent(ctx.channel(), networkMessage.getRemoteAddress(), originalMessage, decodedMessage);
            if (decodedMessage == null) {
                decodedMessage = handleEmptyMessage(ctx.channel(), networkMessage.getRemoteAddress(), originalMessage);
            }
            if (decodedMessage != null) {
                if (decodedMessage instanceof Collection collection) {
                    ctx.writeAndFlush(new AcknowledgementHandler.EventDecoded(collection));
                    for (Object o : collection) {
                        saveOriginal(o, originalMessage);
                        ctx.fireChannelRead(o);
                    }
                } else {
                    ctx.writeAndFlush(new AcknowledgementHandler.EventDecoded(List.of(decodedMessage)));
                    saveOriginal(decodedMessage, originalMessage);
                    ctx.fireChannelRead(decodedMessage);
                }
            } else {
                ctx.writeAndFlush(new AcknowledgementHandler.EventDecoded(List.of()));
            }
        } finally {
            ReferenceCountUtil.release(originalMessage);
        }
    }
Method called when config is initialized.
src/main/java/org/traccar/ExtendedObjectDecoder.java