Windows firewalls can often misinterpret the game's network traffic as a potential threat and block the connection. Adjusting the settings to allow Minecraft can solve this issue.