@Test
public void readHandlesGetMediaError() throws Exception {

  fakeService.setGetMediaException(
      Status.fromCode(Status.Code.INTERNAL)
          .withDescription("Custom error message.")
          .asException());
  GoogleCloudStorageGrpcReadChannel readChannel = newReadChannel();
  ByteBuffer buffer = ByteBuffer.allocate(10);
  IOException thrown = assertThrows(IOException.class, () -> readChannel.read(buffer));
  assertTrue(thrown.getCause().getMessage().contains("Custom error message."));
}