static Optional<RateLimitInfo> createRateLimitFromHeaders(Headers headers) {
        if (headers == null) {
            return Optional.empty();
        }

        Set<String> names = headers.names();
        if (!names.containsAll(
                Arrays.asList(NS_RATELIMIT_LIMIT, NS_RATELIMIT_REMAINING, NS_RATELIMIT_RESET))) {
            return Optional.empty();
        }

        return RateLimitInfo.createFromHeaders(
                headers.get(NS_RATELIMIT_LIMIT),
                headers.get(NS_RATELIMIT_REMAINING),
                headers.get(NS_RATELIMIT_RESET));
    }
@Test
    public void testParseHeaders() {
        Optional<RateLimitInfo> info =
                NodesmithHttpService.createRateLimitFromHeaders(
                        Headers.of(
                                NodesmithHttpService.NS_RATELIMIT_LIMIT, "500",
                                NodesmithHttpService.NS_RATELIMIT_REMAINING, "442",
                                NodesmithHttpService.NS_RATELIMIT_RESET, "1553385403"));

        assertTrue(info.isPresent());
        assertEquals(500, info.get().getTotalAllowedInWindow());
        assertEquals(442, info.get().getRemainingInWindow());
        assertEquals(1553385403L, info.get().getWindowResetTime().getEpochSecond());
    }