Handling response from server in Netty client
<p>I'm writing a JavaFX application using Netty to implement a custom protocol. There is no session state but I would like to correlate a server response to a particular outbound request (and return the result to the correct JavaFX <code>Task</code>.) So far I haven't been able to do so in the client code, because the responseFuture is a <code>ChannelFuture&lt;Void&gt;</code>.</p>

<pre><code>future = tcpBoostrap.connect(address, 3333).sync();
final Channel channel = future.awaitUninterruptibly().channel();

ChannelFuture responseFuture = channel.writeAndFlush(requestBuilder.build());
responseFuture.addListener(new ChannelFutureListener() {
    @Override
    public void operationComplete(ChannelFuture channelFuture) throws Exception {
        if (channelFuture.isSuccess()) {
            logger.debug("completed operation: {}", channelFuture.toString());
        }
    }
});
</code></pre>

<p>I tried looking how to configure a <code>PipeLine</code> to somehow install <code>ChannelHandlers</code> that would share the information in a shared context variable but I could not find anything significant. </p>

<p>Can anyone suggest the idiomatic place where I can stuff the UI Task that I can "complete" with the response in Netty?</p>