@Test
  public void kmsAeadGrpc_bothKmsCliensAreGiven() throws Exception {
    String keyName = "projects/cloudkms-test/locations/global/keyRings/TinkKmsLib/cryptoKeys/key1";
    FakeCloudKms fakeKms = new FakeCloudKms(asList(keyName));
    assertThrows(
        GeneralSecurityException.class,
        () ->
            GcpKmsAead.builder()
                .setKeyName(keyName)
                .setCloudKms(fakeKms)
                .setKeyManagementServiceClient(kmsClient)
                .build());
  }
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