@Test
public void decode () throws Exception {

  val value = new byte[] { 1, 2, 3 };
  val bytes = Bytes.resizableArray()
      .write1B(BINARY.getCode())
      .write4B(value.length)
      .writeNB(value)
      .arrayCopy();
  try (val input = new OtpInputStream(bytes)) {
    ErlangBinary binary = ErlangTerm.newInstance(wrappedBuffer(bytes));
    assertThat(binary.asBinary())
        .isEqualTo(input.read_binary());
  }
}