default long getExpireTimeWithBufferEpochMs(final RefreshMode refreshMode) {
        final long refreshBufferMs = Math.max(0, getRefreshBufferMs());
        return switch (Objects.requireNonNull(refreshMode)) {
            case EAGER -> {
                long effectiveBufferMs;
                if (refreshBufferMs > 0) {
                    effectiveBufferMs = (long) (EAGER_REFRESH_BUFFER_FACTOR * refreshBufferMs);
                } else {
                    effectiveBufferMs = 0;
                }
                yield getExpireTimeEpochMs() - effectiveBufferMs;
            }
            case JUST_IN_TIME -> getExpireTimeEpochMs() - refreshBufferMs;
        };
    }
@return The time prior to the expiry time after which a refresh is required.
This buffer ensures the token has enough life remaining for the user of the token
to successfully use it.
stroom-util/src/main/java/stroom/util/authentication/Refreshable.java