Improve resource binding code

the server is required to return a JID. The code was duplicated more or
less four times.
Add afterSuccessfulLogin to avoid code duplication
Fix waiting for resource binding
Fix bind jid being null
Fix sm available
minor formating fix
Add sm feature
Add instantShutdown()
Check for depth and start tag
Let's resume that stream
Improve sync points
More work
More work
Report TLS failures