diff --git a/codec/src/test/java/io/netty/handler/codec/xml/XmlFrameDecoderTest.java b/codec/src/test/java/io/netty/handler/codec/xml/XmlFrameDecoderTest.java index db3660accf..8fca1bba01 100644 --- a/codec/src/test/java/io/netty/handler/codec/xml/XmlFrameDecoderTest.java +++ b/codec/src/test/java/io/netty/handler/codec/xml/XmlFrameDecoderTest.java @@ -142,6 +142,11 @@ public class XmlFrameDecoderTest { testDecodeWithXml(input, frame1, frame2, frame3); } + @Test + public void testFraming() { + testDecodeWithXml(Arrays.asList("123"), "123"); + } + @Test public void testDecodeWithSampleXml() { for (final String xmlSample : xmlSamples) { @@ -149,11 +154,13 @@ public class XmlFrameDecoderTest { } } - private static void testDecodeWithXml(String xml, Object... expected) { + private static void testDecodeWithXml(List xmlFrames, Object... expected) { EmbeddedChannel ch = new EmbeddedChannel(new XmlFrameDecoder(1048576)); Exception cause = null; try { - ch.writeInbound(Unpooled.copiedBuffer(xml, CharsetUtil.UTF_8)); + for (String xmlFrame : xmlFrames) { + ch.writeInbound(Unpooled.copiedBuffer(xmlFrame, CharsetUtil.UTF_8)); + } } catch (Exception e) { cause = e; } @@ -180,6 +187,10 @@ public class XmlFrameDecoderTest { } } + private static void testDecodeWithXml(String xml, Object... expected) { + testDecodeWithXml(Collections.singletonList(xml), expected); + } + private String sample(String number) throws IOException, URISyntaxException { String path = "io/netty/handler/codec/xml/sample-" + number + ".xml"; URL url = getClass().getClassLoader().getResource(path);