Server handler pipeline

A straight forward Server pipeline consists of:

@Override
    public ChannelPipeline getPipeline() throws Exception {
		ChannelPipeline pipeline = pipeline();
		pipeline.addLast("decoder",new IcapRequestDecoder());
		pipeline.addLast("encoder",new IcapResponseEncoder());
		pipeline.addLast("handler",new IcapServerHandler());
		return pipeline;
    }

Analog to the Client example you also have the possibility to abstract from the tedious message body chunk handling and add two additional handlers which will take care of the chunked message body. It is important to understand that in this scenario (if you plan to send a message body) you have to attach the message body to the respective HTTP request or response.

@Override
    public ChannelPipeline getPipeline() throws Exception {
		ChannelPipeline pipeline = pipeline();
		pipeline.addLast("decoder",new IcapRequestDecoder());
		pipeline.addLast("chunkAggregator",new IcapChunkAggregator(4096));
		pipeline.addLast("encoder",new IcapResponseEncoder());
		pipeline.addLast("chunkSeparator",new IcapChunkSeparator(4096));
		pipeline.addLast("handler",new IcapServerHandler());
		return pipeline;
    }