final ConnectionConfiguration cfg, XMPPException originalException)
throws XMPPException, SmackException {
try {
LOGGER.info("Retrying connection with legacy SSL");
cfg.setSocketFactory(SSLSocketFactory.getDefault());
this.connection = new XMPPTCPConnection(cfg);
this.connection.connect();
} catch (XMPPException e) {
if (originalException != null) {
// use the original connection exception as legacy SSL should only
// be a fallback