protected final void checkNotClosed() {
        if (closed) {
            throw new IllegalStateException("This connection manager has already been closed.");
        }
    }
@Test
    void testCheckNotClosed() {
        AbstractServiceConnectionManager<Object> connectionManager =
                new TestServiceConnectionManager();

        connectionManager.checkNotClosed();

        connectionManager.connect(new Object());
        connectionManager.checkNotClosed();

        connectionManager.disconnect();
        connectionManager.checkNotClosed();

        connectionManager.close();
        assertThatThrownBy(connectionManager::checkNotClosed)
                .as("checkNotClosed() did not fail for a closed connection manager")
                .isInstanceOf(IllegalStateException.class);
    }