Fixed to pass current unit tests.
Added server/client connected unit test.