fix bug and add test case for connect server