make use of socketpair instead of pipe

One benefit of using socketpair is that socket object has destroctor and automatically close the fd, while
os.pipe() returns simple int objects. This makes more safe for fd leak.