@Override
  public int read() throws IOException {
    byte[] b = new byte[1];
    if (read(b, 0, 1) != 1) {
      return -1;
    } else {
      return b[0];
    }
  }
@Test
    public void testReadEos() throws Exception {
        DistributedLogManager dlm = mock(DistributedLogManager.class);
        LogReader reader = mock(LogReader.class);
        when(dlm.getInputStream(any(DLSN.class))).thenReturn(reader);
        when(reader.readNext(anyBoolean())).thenThrow(new EndOfStreamException("eos"));

        byte[] b = new byte[1];
        DLInputStream in = new DLInputStream(dlm);
        assertEquals("Should return 0 when reading an empty eos stream",
            0, in.read(b, 0, 1));
        assertEquals("Should return -1 when reading an empty eos stream",
            -1, in.read(b, 0, 1));
    }