long retrieveInterval(/*@NonNull*/ HeartbeatSender sender) {
        Long intervalInConfig = TransportConfig.getHeartbeatIntervalMs();
        if (isValidHeartbeatInterval(intervalInConfig)) {
            RecordLog.info("[HeartbeatSenderInitFunc] Using heartbeat interval "
                + "in Sentinel config property: " + intervalInConfig);
            return intervalInConfig;
        } else {
            long senderInterval = sender.intervalMs();
            RecordLog.info("[HeartbeatSenderInit] Heartbeat interval not configured in "
                + "config property or invalid, using sender default: " + senderInterval);
            return senderInterval;
        }
    }
@Test
    public void testRetrieveInterval() {
        HeartbeatSender sender = mock(HeartbeatSender.class);

        long senderInterval = 5666;
        long configInterval = 6777;

        when(sender.intervalMs()).thenReturn(senderInterval);

        HeartbeatSenderInitFunc func = new HeartbeatSenderInitFunc();
        assertEquals(senderInterval, func.retrieveInterval(sender));

        // Invalid interval.
        SentinelConfig.setConfig(TransportConfig.HEARTBEAT_INTERVAL_MS, "-1");
        assertEquals(senderInterval, func.retrieveInterval(sender));

        SentinelConfig.setConfig(TransportConfig.HEARTBEAT_INTERVAL_MS, String.valueOf(configInterval));
        assertEquals(configInterval, func.retrieveInterval(sender));
    }