Added an option to throw an exception when a connect fails instead of exitting the jvm using System.exit()