// Set up the pipeline factory.
bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
public ChannelPipeline getPipeline() throws Exception {
return Channels.pipeline(
new ZMTP10Codec(new ZMTPSession(ZMTPConnectionType.Addressed, "client".getBytes())),
new OneToOneDecoder() {
@Override
protected Object decode(final ChannelHandlerContext ctx, final Channel channel,
final Object msg) throws Exception {
if (onMessage((ZMTPIncomingMessage) msg)) {
receivedMessage = true;