104105106107108109110111112113114
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());
108109110111112113114115116117118
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));
112113114115116117118119120121122
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();
118119120121122123124125126127128
channel = newChannel("\r\nFour"); inbuf.fill(channel); line.clear(); assertTrue(inbuf.readLine(line, false)); assertEquals("Three", line.toString()); inbuf.fill(channel); line.clear();
124125126127128129130131132133134
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)); }
128129130131132133134135136137138
line.clear(); assertTrue(inbuf.readLine(line, true)); assertEquals("Four", line.toString()); line.clear(); assertFalse(inbuf.readLine(line, true)); } public void testWriteLineChunks() throws Exception { HttpParams params = new BasicHttpParams();
144145146147148149150151152153154
inbuf.fill(inChannel); CharArrayBuffer line = new CharArrayBuffer(64); line.clear(); assertTrue(inbuf.readLine(line, false)); assertEquals("One", line.toString()); outbuf.writeLine(line); line.clear();
150151152153154155156157158159160
assertEquals("One", line.toString()); outbuf.writeLine(line); line.clear(); assertTrue(inbuf.readLine(line, false)); assertEquals("Two", line.toString()); outbuf.writeLine(line); line.clear();
156157158159160161162163164165166
assertEquals("Two", line.toString()); outbuf.writeLine(line); line.clear(); assertFalse(inbuf.readLine(line, false)); inChannel = newChannel("\r\nFour"); inbuf.fill(inChannel); line.clear();
162163164165166167168169170171172
inChannel = newChannel("\r\nFour"); inbuf.fill(inChannel); line.clear(); assertTrue(inbuf.readLine(line, false)); assertEquals("Three", line.toString()); outbuf.writeLine(line); inbuf.fill(inChannel);