@Test
public void decode () throws Exception {

  val value1 = "hello";
  val bytes1 = Bytes.resizableArray()
      .write1B(SMALL_ATOM_UTF8.getCode())
      .write1B(value1.getBytes(UTF_8).length)
      .writeNB(value1.getBytes(UTF_8))
      .arrayCopy();
  try (val input = new OtpInputStream(bytes1)) {
    ErlangAtom atom = ErlangTerm.newInstance(Unpooled.wrappedBuffer(bytes1));
    assertThat(atom.asText())
        .isEqualTo(input.read_atom());
  }
  val value2 = "попа";
  val bytes2 = Bytes.resizableArray()
      .write1B(ATOM_UTF8.getCode())
      .write2B(value2.getBytes(UTF_8).length)
      .writeNB(value2.getBytes(UTF_8))
      .arrayCopy();
  try (val input = new OtpInputStream(bytes2)) {
    ErlangAtom atom = ErlangTerm.newInstance(Unpooled.wrappedBuffer(bytes2));
    assertThat(atom.asText())
        .isEqualTo(input.read_atom());
  }
}