resolveEndpoint

fun resolveEndpoint(rawAddress: String, tlsEnabled: Boolean): MqttEndpoint(source)

Resolve a user-supplied broker address into an MqttEndpoint.

Address resolution rules:

  • If rawAddress already contains a URI scheme (scheme://…), parse it directly via MqttEndpoint.parse and respect whatever transport / port the user encoded.

  • Otherwise wrap it as a TCP endpoint using standard MQTT ports: port 8883 if tlsEnabled is true, port 1883 otherwise. This allows standard MQTT brokers to work out of the box.

Extracted as a top-level function so MQTTRepositoryImplTest can exercise every branch without spinning up the full repository, and so MqttManagerImpl (in :core:data) can reuse the same parsing rules for the probe API. Visibility is public because Kotlin's internal is scoped per Gradle module.