@Test public void testTooLongLineWithFailFast() throws Exception { EmbeddedChannel ch = new EmbeddedChannel(new LineBasedFrameDecoder(16, false, true)); try { ch.writeInbound(copiedBuffer("12345678901234567", CharsetUtil.US_ASCII)); fail(); } catch (Exception e) { assertThat(e, is(instanceOf(TooLongFrameException.class))); } assertThat(ch.writeInbound(copiedBuffer("890", CharsetUtil.US_ASCII)), is(false)); assertThat(ch.writeInbound(copiedBuffer("123\r\nfirst\r\n", CharsetUtil.US_ASCII)), is(true)); assertThat(releaseLater((ByteBuf) ch.readInbound()), is(releaseLater(copiedBuffer("first\r\n", CharsetUtil.US_ASCII)))); assertThat(ch.finish(), is(false)); }
private void fail(final ChannelHandlerContext ctx, int length) { fail(ctx, String.valueOf(length)); }
LineBasedFrameDecoder extends ByteToMessageDecoder { private void fail(final ChannelHandlerContext ctx, int length) { fail(ctx, String.valueOf(length)); } }
LineBasedFrameDecoder extends ByteToMessageDecoder { private void fail(final ChannelHandlerContext ctx, int length) { fail(ctx, String.valueOf(length)); } LineBasedFrameDecoder(final int maxLength);  LineBasedFrameDecoder(final int maxLength, final boolean stripDelimiter, final boolean failFast); }
LineBasedFrameDecoder extends ByteToMessageDecoder { private void fail(final ChannelHandlerContext ctx, int length) { fail(ctx, String.valueOf(length)); } LineBasedFrameDecoder(final int maxLength);  LineBasedFrameDecoder(final int maxLength, final boolean stripDelimiter, final boolean failFast);  }
LineBasedFrameDecoder extends ByteToMessageDecoder { private void fail(final ChannelHandlerContext ctx, int length) { fail(ctx, String.valueOf(length)); } LineBasedFrameDecoder(final int maxLength);  LineBasedFrameDecoder(final int maxLength, final boolean stripDelimiter, final boolean failFast);   }