refactor tcp connect test