refactor xrelay and socks5 with XReadWriter