Finally, I found where the problem is. There is a sendBackgroundApiCommand() implementation in public abstract class AbstractEslClientHandler extends SimpleChannelInboundHandler<EslMessage>. The NPE happens when thenComposeAsync() is being called and the reason for that is callbackExecutor. not initialized.
public CompletableFuture<EslEvent> sendBackgroundApiCommand(Channel channel, final String command) {
return sendApiSingleLineCommand(channel, command)
.thenComposeAsync(result -> {
// some code here
}
}, callbackExecutor);
}
I added intialization to a child class like below and the problem gone.
class InboundClientHandler extends AbstractEslClientHandler {
// ...
public InboundClientHandler(String password, IEslProtocolListener listener) {
this.password = password;
this.listener = listener;
this.callbackExecutor = Executors.newSingleThreadExecutor();
}
// ...
}