Use WebSocket to connect agents rather than the TCP port. This need Jenkins 2.217 and above. See WebSocket and JEP-222 for background.