Nmap switches to a direct connection without errors, it’s gonna keep on scanning like it’s nobody’s business. But your traffic loses its undercover charm.
Nmap, default settings and all, plays it cool. If it can’t hook up with the proxy you specified, it’s cool with going direct, is this way so that even if the proxy takes a coffee break mid-scan, it’s just gonna keep on scanning sans the proxy no drama.
You said you’re trying to scan using TOR? Nmap is slow enough sometimes on its own, I can only imagine trying to use TOR with it. Also, HOW exactly are you trying to use TOR? I didn’t see any mention of it in the command you provided, did you torify your shell using . tor socks on? Or did you you use services start tor?
When you use Tor or other proxies through the command --proxies socks4://127.0.0.1:9050 you are telling the scanner to use the given proxy to connect to the target www.example.com.
Once the scanner tries to connect through Tor or the proxy it will receive a response back saying that the connection was successful. If you stop the Tor service, the scanner will try to use another random proxy to connect to the target again. This is a common feature of most scanners such as Nmap, Burp, Zap and so on.