public void waitFor(final Supplier<RequestSpecification> supplier, final Method method, final String endpoint, final ResponseSpecification expected) throws TimeoutException {
        final Map<String, String> contextMap = MDC.getCopyOfContextMap();
        Future<?> future = EXECUTOR.submit(() -> {
            MDC.setContextMap(contextMap);
            
            for (int i = 0; i < retryTimes; i++) {
                try {
                    ValidatableResponse response = supplier.get()
                            .request(method, endpoint)
                            .then()
                            .assertThat();
                    response.spec(expected);
                    
                    if (log.isDebugEnabled()) {
                        log.debug(response.extract().asPrettyString());
                    }
                    return;
                } catch (AssertionError e) {
                    log.debug("failed to check endpoint '{}'\n {}", endpoint, e.getMessage());
                }
                
                try {
                    TimeUnit.MILLISECONDS.sleep(timeInRetry.toMillis());
                } catch (InterruptedException ex) {
                    log.error(ex.getMessage(), ex);
                }
            }
        });
        
        try {
            future.get(timeout.toMillis(), TimeUnit.MILLISECONDS);
            log.info("check endpoint({}) successful", endpoint);
        } catch (ExecutionException | InterruptedException | TimeoutException e) {
            future.cancel(true);
            throw new TimeoutException("checking endpoint '" + endpoint + "' timeout after " + timeout);
        }
    }
Check if the endpoint is successful. If unsuccessful, retry until the maximum number of times is reached.

@param supplier supplier
@param method method
@param endpoint endpoint
@param expected expected
@throws TimeoutException TimeoutException
shenyu-e2e/shenyu-e2e-engine/src/main/java/org/apache/shenyu/e2e/engine/scenario/function/WaitForHelper.java