reorg client to be connection aware, and have a real test
finish fixing server and a full test of it