private void assertHeartbeat(HeartbeatRequestManager hrm, int nextPollMs) {
        NetworkClientDelegate.PollResult pollResult = hrm.poll(time.milliseconds());
        assertEquals(1, pollResult.unsentRequests.size());
        assertEquals(nextPollMs, pollResult.timeUntilNextPollMs);
        pollResult.unsentRequests.get(0).handler().onComplete(createHeartbeatResponse(pollResult.unsentRequests.get(0),
            Errors.NONE));
    }
This is expected to be the case where a member is already leaving the group and the poll
timer expires. The poll timer expiration should not transition the member to STALE, and
the member should continue to send heartbeats while the ongoing leaving operation
completes (send heartbeats while waiting for callbacks before leaving, or send last
heartbeat to leave).
clients/src/test/java/org/apache/kafka/clients/consumer/internals/HeartbeatRequestManagerTest.java