@Override
    public ScheduledExecutor getScheduledExecutor() {
        return internalScheduledExecutor;
    }
@Test
    void testScheduledExecutorServiceCancelWithFixedDelay() throws InterruptedException {
        ScheduledExecutor scheduledExecutor = pekkoRpcService.getScheduledExecutor();

        long delay = 10L;

        final OneShotLatch futureTask = new OneShotLatch();
        final OneShotLatch latch = new OneShotLatch();
        final OneShotLatch shouldNotBeTriggeredLatch = new OneShotLatch();

        ScheduledFuture<?> future =
                scheduledExecutor.scheduleWithFixedDelay(
                        () -> {
                            try {
                                if (futureTask.isTriggered()) {
                                    shouldNotBeTriggeredLatch.trigger();
                                } else {
                                    // first run
                                    futureTask.trigger();
                                    latch.await();
                                }
                            } catch (InterruptedException ignored) {
                                // ignore
                            }
                        },
                        delay,
                        delay,
                        TimeUnit.MILLISECONDS);

        // wait until we're in the runnable
        futureTask.await();

        // cancel the scheduled future
        future.cancel(false);

        latch.trigger();

        assertThatThrownBy(() -> shouldNotBeTriggeredLatch.await(5 * delay, TimeUnit.MILLISECONDS))
                .isInstanceOf(TimeoutException.class);
    }