@Test
  public void kmsAeadGrpc_encryptDecryptEmptyString_success() throws Exception {
    String keyName = "projects/cloudkms-test/locations/global/keyRings/TinkKmsLib/cryptoKeys/key1";
    Aead kmsAead =
        GcpKmsAead.builder().setKeyName(keyName).setKeyManagementServiceClient(kmsClient).build();

    byte[] plaintext = "".getBytes(UTF_8);
    byte[] associatedData = "associatedData".getBytes(UTF_8);
    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