Some small reconnecting client fixes.

- added an optional initial connection delay
- fix issue in gen_server termination
- add possibility so started gen_server can register itself.
Merge remote-tracking branch 'arjan/reconnecting-client-fixes'