First of all ensure that your internet connection is working properly. Try moving closer to your router.
To perform the speed test we transfer (Download speed) and receive (Upload speed) a small amount of data to your computer network. In case you have a firewall or an antivirus software, it might interpret this process as an attack thus temporarily disabling such software can fix this issue.
If you are using a Virtual Private Network (VPN) you may encounter the error.