assertFalse(inbuf.readLine(line, true));
}
public void testWriteLineChunks() throws Exception {
SessionOutputBuffer outbuf = new SessionOutputBuffer(16, 16);
SessionInputBuffer inbuf = new SessionInputBuffer(16, 16);
ReadableByteChannel inChannel = newChannel("One\r\nTwo\r\nThree");
inbuf.fill(inChannel);
CharArrayBuffer line = new CharArrayBuffer(64);
line.clear();
assertTrue(inbuf.readLine(line, false));
assertEquals("One", line.toString());
outbuf.writeLine(line);
line.clear();
assertTrue(inbuf.readLine(line, false));
assertEquals("Two", line.toString());
outbuf.writeLine(line);
line.clear();
assertFalse(inbuf.readLine(line, false));
inChannel = newChannel("\r\nFour");
inbuf.fill(inChannel);
line.clear();
assertTrue(inbuf.readLine(line, false));
assertEquals("Three", line.toString());
outbuf.writeLine(line);
inbuf.fill(inChannel);
line.clear();
assertTrue(inbuf.readLine(line, true));
assertEquals("Four", line.toString());
outbuf.writeLine(line);
line.clear();
assertFalse(inbuf.readLine(line, true));
ByteArrayOutputStream outstream = new ByteArrayOutputStream();
WritableByteChannel outChannel = newChannel(outstream);
outbuf.flush(outChannel);
String s = new String(outstream.toByteArray(), "US-ASCII");
assertEquals("One\r\nTwo\r\nThree\r\nFour\r\n", s);
}