Close Minecraft entirely and restart it; make sure you are connected to an internet connection. Restarting your router may also help you to get out of this error.