byte[] raw = teststr.getBytes("US-ASCII");
BufferedLineReaderInputStream inbuffer = new BufferedLineReaderInputStream(new ByteArrayInputStream(raw), 20);
LineReaderInputStream instream = new MimeBoundaryInputStream(inbuffer, "1234");
ByteArrayBuffer linebuf = new ByteArrayBuffer(8);
linebuf.clear();
instream.readLine(linebuf);
String s = new String(linebuf.toByteArray(), "US-ASCII");
assertEquals("01234567890123456789\n", s);
linebuf.clear();
instream.readLine(linebuf);
s = new String(linebuf.toByteArray(), "US-ASCII");
assertEquals("\n", s);
linebuf.clear();
instream.readLine(linebuf);
s = new String(linebuf.toByteArray(), "US-ASCII");
assertEquals("\r\n", s);
linebuf.clear();
instream.readLine(linebuf);
s = new String(linebuf.toByteArray(), "US-ASCII");
assertEquals("\r\r\n", s);
linebuf.clear();
instream.readLine(linebuf);
s = new String(linebuf.toByteArray(), "US-ASCII");
assertEquals("\n", s);
linebuf.clear();
instream.readLine(linebuf);
s = new String(linebuf.toByteArray(), "US-ASCII");
assertEquals("\n", s);
linebuf.clear();
instream.readLine(linebuf);
s = new String(linebuf.toByteArray(), "US-ASCII");
assertEquals("\n", s);
linebuf.clear();
instream.readLine(linebuf);
s = new String(linebuf.toByteArray(), "US-ASCII");
assertEquals("\n", s);
assertEquals(-1, instream.readLine(linebuf));
assertEquals(-1, instream.readLine(linebuf));
}