bool b = connection.isConnected() == true ? true : false;
My first internship presented me with this.