@Test
  public void kmsAead_encryptDecryptEmptyString_success() throws Exception {
    String keyName = "projects/tink-test/locations/global/keyRings/unit-test/cryptoKeys/aead-key";
    FakeCloudKms fakeKms = new FakeCloudKms(asList(keyName));

    byte[] plaintext = "".getBytes(UTF_8);
    byte[] associatedData = "associatedData".getBytes(UTF_8);

    Aead kmsAead = new GcpKmsAead(fakeKms, keyName);

    byte[] ciphertext = kmsAead.encrypt(plaintext, associatedData);
    byte[] decrypted = kmsAead.decrypt(ciphertext, associatedData);
    assertThat(decrypted).isEqualTo(plaintext);
  }
This rule manages automatic graceful shutdown for the registered servers and channels.
java_src/src/test/java/com/google/crypto/tink/integration/gcpkms/GcpKmsAeadTest.java