assertEquals(-1, receiver.read());
assertEquals(-1, receiver.read());
}
public void testLineLimit() throws Exception {
HttpParams params = new DefaultHttpParams();
String s = "a very looooooooooooooooooooooooooooooooooooooong line\r\n ";
byte[] tmp = s.getBytes("US-ASCII");
HttpDataReceiverMockup receiver1 = new HttpDataReceiverMockup(tmp, 5);
// no limit
params.setIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, 0);
receiver1.reset(params);
assertNotNull(receiver1.readLine());
HttpDataReceiverMockup receiver2 = new HttpDataReceiverMockup(tmp, 5);
// 15 char limit
params.setIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, 15);
receiver2.reset(params);
try {
receiver2.readLine();
fail("IOException should have been thrown");
} catch (IOException ex) {