add maxConnectionAttempts option. Closes #27