public ActorSystem getActorSystem() {
        return actorSystem;
    }
@Test
    void testRpcServiceShutDownWithFailingRpcEndpoints() throws Exception {
        final PekkoRpcService pekkoRpcService = startRpcService();

        final int numberActors = 5;

        final RpcServiceShutdownTestHelper rpcServiceShutdownTestHelper =
                startStopNCountingAsynchronousOnStopEndpoints(pekkoRpcService, numberActors);

        final Iterator<CompletableFuture<Void>> iterator =
                rpcServiceShutdownTestHelper.getStopFutures().iterator();

        for (int i = 0; i < numberActors - 1; i++) {
            iterator.next().complete(null);
        }

        iterator.next().completeExceptionally(new OnStopException("onStop exception occurred."));

        assertThatThrownBy(rpcServiceShutdownTestHelper::waitForRpcServiceTermination)
                .satisfies(FlinkAssertions.anyCauseMatches(OnStopException.class));

        assertThat(pekkoRpcService.getActorSystem().whenTerminated().isCompleted()).isTrue();
    }