Resolve #89 by adding an optional max number of retries to connectToAP function.