ZXTM can effectively handle as many ports as are available with your Operating System - so the theoretical maximum is just above 65,000.
(Note that if you do try to manage such a large number of ports, you may run into other limitations - ZXTM will generally need two ports per transaction, the OS may reserve some ports, and you may run into problems with file descriptors. Even at 20,000 ports, the OS may collapse under the strain of opening and closing that number of connections before ZXTM even breaks a sweat!)