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());
 }