fix server side connection closing bug and consistent connection in socks5 when switching host