Client handler pipeline

A straight forward client handler pipeline consists of:

@Override
	public ChannelPipeline getPipeline() throws Exception {
		ChannelPipeline pipeline = pipeline();
		pipeline.addLast("encoder",new IcapRequestEncoder());
		pipeline.addLast("decoder",new IcapResponseDecoder());
		pipeline.addLast("handler",new IcapClientHandler());
		return pipeline;
	}

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("encoder",new IcapRequestEncoder());
		pipeline.addLast("chunkSeparator",new IcapChunkSeparator(4096));
		pipeline.addLast("decoder",new IcapResponseDecoder());
		pipeline.addLast("chunkAggregator",new IcapChunkAggregator(4096));
		pipeline.addLast("handler",new IcapClientHandler());
		return pipeline;
	}