@Test
  public void testEncryptionSmallChunks() throws Exception {
    byte[] ikm = Hex.decode("000102030405060708090a0b0c0d0e0f");
    byte[] associatedData = Hex.decode("aabbccddeeff");
    int keySize = 16;
    int segmentSize = 512;
    int chunkSize = 3; // the size for each concurrent read.
    AesGcmHkdfStreaming ags = new AesGcmHkdfStreaming(ikm, "HmacSha256", keySize, segmentSize, 0);
    testEncryption(ags, associatedData, chunkSize, 1000);
  }
Test for thread safety. This test is an incorrect use case for StreamingAead implementations.
Streams have state and hence their behaviour is not well defined. Nevertheless if an encrypting
channel is used concurrently we expect the following behaviour: (1) The resulting ciphertext
has valid format. (2) All plaintext is encrypted. (3) The thread sanitizer does not find
anything.
java_src/src/test/java/com/google/crypto/tink/subtle/StreamingAeadThreadSafetyTest.java