@Test
public void testReadVarintEndOfInputAtStart() throws IOException, InterruptedException {

  VarintReader reader = new VarintReader();
  // Build an input with no data.
  ExtractorInput input = new FakeExtractorInput.Builder()
      .setSimulateUnknownLength(true)
      .build();
  // End of input allowed.
  long result = reader.readUnsignedVarint(input, true, false, 8);
  assertThat(result).isEqualTo(RESULT_END_OF_INPUT);
  // End of input not allowed.
  try {
    reader.readUnsignedVarint(input, false, false, 8);
    fail();
  } catch (EOFException e) {
    // Expected.
  }
}