code: static void connect(IMqttClient mqttClient, MqttClientDefinition clientDefinition) throws MqttException {
          MqttConnectOptions options = clientDefinition.getConfig().getConnectOptions();
          if (options != null) {
              mqttClient.connect(options);
          } else {
              mqttClient.connect();
          }
      }
docs: Connect a new {@link MqttClient} to a broker.
  
  @param mqttClient       {@link MqttClient} to connect to the broker.
  @param clientDefinition {@link MqttClientDefinition} to use to connect to the broker.
  @throws MqttException if client can not connect to the broker.