public ChannelPipeline getPipeline() throws Exception {
final ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder((int) ((1L << (lengthFieldSize * 8)) - 1) & (-1 >>> 1), 0, lengthFieldSize, 0, lengthFieldSize));
pipeline.addLast("frameEncoder", new LengthFieldPrepender(lengthFieldSize, false));
if (executor != null)
pipeline.addLast("executor", new ExecutionHandler(executor));
pipeline.addLast("logging", new LoggingHandler(logger));
// a node resolver must be added before the mesage codec
pipeline.addLast("messageCodec", new MessageCodec());
pipeline.addLast("nodeResolver", nodeResolver);
pipeline.addLast("common", new SimpleChannelUpstreamHandler() {