public String waitForStatus()

in src/main/java/org/apache/sling/testing/teleporter/client/TeleporterHttpClient.java [122:139]


    public String waitForStatus(String url, int expectedStatus, int timeoutMsec) throws IOException {
        log.debug("Waiting for status {} at {}, timeout {} msec", expectedStatus, url, timeoutMsec);
        final long end = System.currentTimeMillis() + timeoutMsec;
        final Set<Integer> statusSet = new HashSet<Integer>();
        final ExponentialBackoffDelay d = new ExponentialBackoffDelay(50,  250);
        while(System.currentTimeMillis() < end) {
            try {
                final SimpleHttpResponse response = getHttpGetStatus(url);
                statusSet.add(response.getStatus());
                if(response.getStatus() == expectedStatus) {
                    return response.getBody();
                }
                d.waitNextDelay();
            } catch(Exception ignore) {
            }
        }
        throw new IOException("Did not get status " + expectedStatus + " at " + url + " after " + timeoutMsec + " msec, got " + statusSet);
    }