@Test
public void testCrAsLineTermination() {

    TestHandler handler = new TestHandler() {
        @Override
        public boolean messageComplete() {
            return true;
        }
        @Override
        public boolean content(ByteBuffer buffer, boolean last) {
            super.content(buffer, last);
            return false;
        }
    };
    MultiPartParser parser = new MultiPartParser(handler, "AaB03x");
    ByteBuffer data = BufferUtils.toBuffer(
            "--AaB03x\r\n" +
                    "content-disposition: form-data; name=\"field1\"\r\n" +
                    "\r" +
                    "Joe Blow\r\n" +
                    "--AaB03x--\r\n");
    BadMessageException x = assertThrows(BadMessageException.class,
            () -> parser.parse(data, true),
            "Invalid EOL");
    assertTrue(x.getMessage().contains("Bad EOL"));
}