Merge pull request #1 from thegboat/master

adding recovery logic for idle connections
Merge pull request #2 from thegboat/master

gentle reconnection