コード例 #1
0
 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());
 }
コード例 #2
0
 public void runTest() throws Exception {
   Reader reader = new Reader();
   for (int i = 0; i < 1000; i++) {
     reader.run();
   }
 }