In our case, we got an error when trying to connect to mqtt server URL when it was set to non-secured (TCP). When connecting to server over SSL (over port 8883), the issue resolved itself. For some reason, DNS resolution doesn’t work and we are forced to use the ip address of the server when SSL isn’t enabled.
Following this page(and all the associated linked pages) on the internet was enough to get us functional setup: Using The Mosquitto_pub and Mosquitto_sub MQTT Client Tools- Examples