@Test
// Check the decoder is reading MetadataInputBuffer.data.limit() correctly.
public void decode_respectsLimit() {

  byte[] icyTitle = "StreamTitle='test title';".getBytes(UTF_8);
  byte[] icyUrl = "StreamURL='test_url';".getBytes(UTF_8);
  byte[] paddedRawBytes = TestUtil.joinByteArrays(icyTitle, icyUrl);
  MetadataInputBuffer metadataBuffer = createMetadataInputBuffer(paddedRawBytes);
  // Stop before the stream URL.
  metadataBuffer.data.limit(icyTitle.length);
  Metadata metadata = decoder.decode(metadataBuffer);
  assertThat(metadata.length()).isEqualTo(1);
  IcyInfo streamInfo = (IcyInfo) metadata.get(0);
  assertThat(streamInfo.rawMetadata).isEqualTo(icyTitle);
  assertThat(streamInfo.title).isEqualTo("test title");
  assertThat(streamInfo.url).isNull();
}