backport any-to-tcp from 3.x