'Create a pair of socket and setup \'connected\' handler'

def create_write_socket(self, on_connected):

    write_sock = socket.socket()
    write_sock.setblocking(0)
    err = write_sock.connect_ex(self.listen_addr)
    self.assertIn(err, (errno.EINPROGRESS, errno.EWOULDBLOCK))
    fd_ = self.save_sock(write_sock)
    self.ioloop.add_handler(fd_, on_connected, WRITE)
    return write_sock
