handle max retries in send
- add more debugging stuff.
- revert commit a2f53628e902f3d279175fa880e70c72204758b2 (breaks SASL authentication
with BOSH)
fix max restart (TSUN-252)