I modified C:\Windows\System32\drivers\etc\hosts
for a local test.
However, the browser did not respect to the change in hosts file.
At last, I found it’s due to the proxy settings in my machine.
Change in hosts took effect once after I unchecked all proxy configuration in
Control Panel -> Internet Options -> Connections -> LAN settings.
If unfortunately in your network, connections are proxied by force (for example, in a corporate network), you can try to let the proxy bypass some domains by adding the domains into LAN settings -> Proxy server -> Advanced -> Exceptions.