private void testDecoding(ChannelBuffer buf, RequestMatcher ... requestMatchers) throws Exception
{
DummyInputGate inputGate = new DummyInputGate();
HttpDecoder decoder = new HttpDecoder(inputGate);
MessageEvent msg = mock(MessageEvent.class);
when(msg.getMessage()).thenReturn(buf);
ChannelConfig channelConfig = mock(ChannelConfig.class);
when(channelConfig.getBufferFactory()).thenReturn(new HeapChannelBufferFactory());
Channel channel = mock(Channel.class);
when(channel.getConfig()).thenReturn(channelConfig);
ChannelHandlerContext ctx = mock(ChannelHandlerContext.class);
when(ctx.getChannel()).thenReturn(channel);
// Decode
decoder.messageReceived(ctx, msg);
// Check result
assertThat("Should yield "+requestMatchers.length+" input requests", inputGate.requests.size(), is(requestMatchers.length));