code: void notifyListenersOnStateChange() {
          LOGGER.debug("Notifying connection listeners about state change to {}", state);
          
          for (ConnectionListener listener : connectionListeners) {
              switch (state) {
                  case CONNECTED:
                      listener.onConnectionEstablished(connection);
                      break;
                  case CONNECTING:
                      listener.onConnectionLost(connection);
                      break;
                  case CLOSED:
                      listener.onConnectionClosed(connection);
                      break;
                  default:
                      break;
              }
          }
      }
docs: Notifies all connection listener about a state change.