@After
  public void afterTest() throws Exception {
    ioManager.shutdown();
    Assert.assertTrue("IO Manager has not properly shut down.", ioManager.isProperlyShutDown());

    Assert.assertTrue(
        "Not all memory was returned to the memory manager in the test.", memManager.verifyEmpty());
    memManager.shutdown();
    memManager = null;
  }
  private final void testChannelWithSegments(int numSegments) throws Exception {
    final List<MemorySegment> memory = this.memManager.allocatePages(memoryOwner, numSegments);
    final Channel.ID channel = this.ioManager.createChannel();

    BlockChannelWriter writer = null;
    BlockChannelReader reader = null;

    try {
      writer = this.ioManager.createBlockChannelWriter(channel);
      final ChannelWriterOutputView out =
          new ChannelWriterOutputView(writer, memory, this.memManager.getPageSize());

      long writeStart = System.currentTimeMillis();

      int valsLeft = NUM_INTS_WRITTEN;
      while (valsLeft-- > 0) {
        out.writeInt(valsLeft);
      }

      out.close();
      final int numBlocks = out.getBlockCount();
      writer.close();
      writer = null;

      long writeElapsed = System.currentTimeMillis() - writeStart;

      // ----------------------------------------------------------------

      reader = ioManager.createBlockChannelReader(channel);
      final ChannelReaderInputView in =
          new ChannelReaderInputView(reader, memory, numBlocks, false);

      long readStart = System.currentTimeMillis();

      valsLeft = NUM_INTS_WRITTEN;
      while (valsLeft-- > 0) {
        in.readInt();
        //				Assert.assertTrue(rec.getValue() == valsLeft);
      }

      in.close();
      reader.close();

      long readElapsed = System.currentTimeMillis() - readStart;

      reader.deleteChannel();
      reader = null;

      LOG.info(
          "IOManager with "
              + numSegments
              + " mem segments: write "
              + writeElapsed
              + " msecs, read "
              + readElapsed
              + " msecs.");

      memManager.release(memory);
    } finally {
      if (reader != null) {
        reader.closeAndDelete();
      }
      if (writer != null) {
        writer.closeAndDelete();
      }
    }
  }