on the TCP level connect sends a packet and waits for a packet with a response. if the response doesn't arrive, it has no information why. then the connection ends on a timeout (around 10 seconds)
if connect returns immediately, then the server refused the connection.
WiFiClientSecure also initializes the secure level. here it can fail on certificates validity. To test this, try to connect with WiFiClient. if WiFiClient connects, then the problem is with the secure level.
and to have this comment complete, connect can also fail on server name resolution. that you can test with WiFi.hostByName function.