Refactor, from udp to tcp, new tests