public boolean isRunning(int attempts, long timeout, TimeUnit timeUnit) {
        try {
            HttpResponse httpResponse = sendRequest(request().withMethod("PUT").withPath(calculatePath("status")));
            if (httpResponse.getStatusCode() == HttpStatusCode.OK_200.code()) {
                return true;
            } else if (attempts == 0) {
                return false;
            } else {
                try {
                    timeUnit.sleep(timeout);
                } catch (InterruptedException e) {
                    // ignore interrupted exception
                }
                return isRunning(attempts - 1, timeout, timeUnit);
            }
        } catch (SocketConnectionException sce) {
            return false;
        }
    }
public boolean isRunning ( int attempts , long timeout , TimeUnit timeUnit ) { try { HttpResponse httpResponse = sendRequest ( request ( ) . withMethod ( "PUT" ) . withPath ( calculatePath ( "status" ) ) ) ; if ( httpResponse . getStatusCode ( ) == HttpStatusCode . OK_200 . code ( ) ) { return true ; } else if ( attempts == 0 ) { return false ; } else { try { timeUnit . sleep ( timeout ) ; } catch ( InterruptedException e ) { } return isRunning ( attempts - 1 , timeout , timeUnit ) ; } } catch ( SocketConnectionException sce ) { return false ; } }
Returns whether server MockServer is running, by polling the MockServer a configurable amount of times