@Override
    public void declareResourceRequirements(ResourceRequirements resourceRequirements) {
        synchronized (lock) {
            checkNotClosed();
            if (isConnected()) {
                currentResourceRequirements = resourceRequirements;

                triggerResourceRequirementsSubmission(
                        Duration.ofMillis(1L),
                        Duration.ofMillis(10000L),
                        currentResourceRequirements);
            }
        }
    }
@Test
    void testDeclareResourceRequirementsSendsRequirementsIfConnected() {
        final DeclareResourceRequirementServiceConnectionManager
                declareResourceRequirementServiceConnectionManager =
                        createResourceManagerConnectionManager();

        final CompletableFuture<ResourceRequirements> declareResourceRequirementsFuture =
                new CompletableFuture<>();
        declareResourceRequirementServiceConnectionManager.connect(
                resourceRequirements -> {
                    declareResourceRequirementsFuture.complete(resourceRequirements);
                    return CompletableFuture.completedFuture(Acknowledge.get());
                });

        final ResourceRequirements resourceRequirements = createResourceRequirements();
        declareResourceRequirementServiceConnectionManager.declareResourceRequirements(
                resourceRequirements);

        assertThat(declareResourceRequirementsFuture.join()).isEqualTo(resourceRequirements);
    }