// TODO(calvin): Make this work with the new BlockReader.
  // @Test
  public void readThroughClientNonExistentTest() throws IOException, TException {
    final int length = 10;
    TachyonFile file =
        TachyonFSTestUtils.createByteFile(
            mTFS, "/testFile", TachyonStorageType.STORE, UnderStorageType.NO_PERSIST, length);
    BlockInfo block = getFirstBlockInfo(file);

    // Get the maximum block id, for use in determining a non-existent block id.
    FileInfo fileInfo = mTFS.getInfo(file);
    long maxBlockId = block.getBlockId();
    for (long blockId : fileInfo.blockIds) {
      if (blockId > maxBlockId) {
        maxBlockId = blockId;
      }
    }

    RemoteBlockReader client =
        RemoteBlockReader.Factory.createRemoteBlockReader(mWorkerTachyonConf);
    ByteBuffer result =
        client.readRemoteBlock(
            new InetSocketAddress(
                block.getLocations().get(0).getWorkerAddress().getHost(),
                block.getLocations().get(0).getWorkerAddress().getDataPort()),
            maxBlockId + 1,
            0,
            length);

    Assert.assertNull(result);
  }
  @Test
  public void readThroughClientTest() throws IOException, TException {
    final int length = 10;
    TachyonFile file =
        TachyonFSTestUtils.createByteFile(
            mTFS, "/testFile", TachyonStorageType.STORE, UnderStorageType.NO_PERSIST, length);
    BlockInfo block = getFirstBlockInfo(file);

    RemoteBlockReader client =
        RemoteBlockReader.Factory.createRemoteBlockReader(mWorkerTachyonConf);
    ByteBuffer result =
        client.readRemoteBlock(
            new InetSocketAddress(
                block.getLocations().get(0).getWorkerAddress().getHost(),
                block.getLocations().get(0).getWorkerAddress().getDataPort()),
            block.getBlockId(),
            0,
            length);

    Assert.assertEquals(BufferUtils.getIncreasingByteBuffer(length), result);
  }