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

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

        final FailingDeclareResourceRequirementsService failingDeclareResourceRequirementsService =
                new FailingDeclareResourceRequirementsService(4);
        declareResourceRequirementServiceConnectionManager.connect(
                failingDeclareResourceRequirementsService);

        final ResourceRequirements resourceRequirements = createResourceRequirements();

        declareResourceRequirementServiceConnectionManager.declareResourceRequirements(
                resourceRequirements);

        scheduledExecutor.triggerNonPeriodicScheduledTasksWithRecursion();

        assertThat(failingDeclareResourceRequirementsService.nextResourceRequirements())
                .isEqualTo(resourceRequirements);
        assertThat(failingDeclareResourceRequirementsService.hasResourceRequirements()).isFalse();
    }