public void testReadEmptyLine() throws Exception {
String teststr = "\n\n\r\n\r\r\n\n\n\n\n\n";
byte[] raw = teststr.getBytes("US-ASCII");
LineReaderInputStreamAdaptor instream = new LineReaderInputStreamAdaptor(
new ByteArrayInputStream(raw));
ByteArrayBuffer linebuf = new ByteArrayBuffer(8);
linebuf.clear();
instream.readLine(linebuf);
String 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("\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);
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));
}