There is a more comprehensive example of a full TLS configuration for MQTT elsewhere on the forum so you should do some more searching for that.
If using self-generated certs, make sure you turn off certificate checks unless you have done ALL of the steps required and provided the full-chain certificate and not just the server cert. since that is the only way that the client will have of checking that the certificate is valid.