private static void testEncryptSingleBytesWithStream(StreamingAead ags, int plaintextSize)
      throws Exception {
    byte[] associatedData = Hex.decode("aabbccddeeff");
    byte[] plaintext = generatePlaintext(plaintextSize);
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    WritableByteChannel ctChannel = Channels.newChannel(bos);
    WritableByteChannel encChannel = ags.newEncryptingChannel(ctChannel, associatedData);
    try (OutputStream encStream = Channels.newOutputStream(encChannel)) {
      for (int i = 0; i < plaintext.length; i++) {
        encStream.write(plaintext[i]);
      }
    }
    isValidCiphertext(ags, plaintext, associatedData, bos.toByteArray());
  }
Encrypts and decrypts some plaintext in a stream using skips and checks that the expected
plaintext is returned for the parts not skipped.

@param ags the StreamingAead test object.
@param firstSegmentOffset number of bytes prepended to the ciphertext stream.
@param plaintextSize the size of the plaintext
@param chunkSize decryption skips and reads chunks of this size.
java_src/src/main/java/com/google/crypto/tink/testing/StreamingTestUtil.java