TSMConnection mostly done.

TSMConnection is mostly done. Some test should now be run to check API
usage scenarios.