private void testReadPagePrefix(String encoding, int iterations) throws Exception {
this.encoding = encoding;
pis = new PipedInputStream();
pos = new PipedOutputStream();
pos.connect(pis);
Task t = RequestProcessor.getDefault().post(this);
Random r = new Random();
int all = 0;
for (int i = 0; i < iterations; i++) {
int size = r.nextInt(100);
String text = "";
for (int j = 0; j < size; j++) {
text = text.concat(hallo);
}
all += size * 10;
pos.write(text.getBytes(encoding));
}
pos.close();
t.waitFinished(10000);
assertNotNull(result);
int expected = Math.min(all, ReporterUtils.MAX_PREFIX_LEN);
assertEquals(expected, result.length());
}