private void testReadWrite(Random rng, Writer wr) throws InterruptedException { ArrayBlockingQueue<byte[]> q = newQueue(); InputStream is = create(q); wr.init(q); wr.start(); Reader rd = new Reader(rng, is); rd.run(); wr.join(); Assert.assertNull(wr.exn); Assert.assertNull(rd.exn); System.out.printf("sums %x -> %x\n", wr.getSum(), rd.getSum()); Assert.assertEquals(wr.getSum(), rd.getSum()); }
public void runTest() throws Exception { Reader reader = new Reader(); for (int i = 0; i < 1000; i++) { reader.run(); } }