100101102103104105106107108109110
inbuf.fill(channel); CharArrayBuffer line = new CharArrayBuffer(64); line.clear(); assertTrue(inbuf.readLine(line, false)); assertEquals("One", line.toString()); line.clear(); assertTrue(inbuf.readLine(line, false)); assertEquals("Two", line.toString());
104105106107108109110111112113114
line.clear(); assertTrue(inbuf.readLine(line, false)); assertEquals("One", line.toString()); line.clear(); assertTrue(inbuf.readLine(line, false)); assertEquals("Two", line.toString()); line.clear(); assertFalse(inbuf.readLine(line, false));
108109110111112113114115116117118
line.clear(); assertTrue(inbuf.readLine(line, false)); assertEquals("Two", line.toString()); line.clear(); assertFalse(inbuf.readLine(line, false)); channel = newChannel("\r\nFour"); inbuf.fill(channel); line.clear();
114115116117118119120121122123124
channel = newChannel("\r\nFour"); inbuf.fill(channel); line.clear(); assertTrue(inbuf.readLine(line, false)); assertEquals("Three", line.toString()); inbuf.fill(channel); line.clear();
120121122123124125126127128129130
assertEquals("Three", line.toString()); inbuf.fill(channel); line.clear(); assertTrue(inbuf.readLine(line, true)); assertEquals("Four", line.toString()); line.clear(); assertFalse(inbuf.readLine(line, true)); }
124125126127128129130131132133134
line.clear(); assertTrue(inbuf.readLine(line, true)); assertEquals("Four", line.toString()); line.clear(); assertFalse(inbuf.readLine(line, true)); } public void testWriteLineChunks() throws Exception { SessionOutputBuffer outbuf = new SessionOutputBuffer(16, 16);
139140141142143144145146147148149
inbuf.fill(inChannel); CharArrayBuffer line = new CharArrayBuffer(64); line.clear(); assertTrue(inbuf.readLine(line, false)); assertEquals("One", line.toString()); outbuf.writeLine(line); line.clear();
145146147148149150151152153154155
assertEquals("One", line.toString()); outbuf.writeLine(line); line.clear(); assertTrue(inbuf.readLine(line, false)); assertEquals("Two", line.toString()); outbuf.writeLine(line); line.clear();
151152153154155156157158159160161
assertEquals("Two", line.toString()); outbuf.writeLine(line); line.clear(); assertFalse(inbuf.readLine(line, false)); inChannel = newChannel("\r\nFour"); inbuf.fill(inChannel); line.clear();
157158159160161162163164165166167
inChannel = newChannel("\r\nFour"); inbuf.fill(inChannel); line.clear(); assertTrue(inbuf.readLine(line, false)); assertEquals("Three", line.toString()); outbuf.writeLine(line); inbuf.fill(inChannel);