In order for the ransomware to fully succeed in encrypting your files, it needs to connect to its key server. This essentially means that there is a window of opportunity to protect your computer by interrupting the encryption process. Many AV vendors have blocklists incorporated in their products; there are also publicly available ones, like the one maintained by abuse.ch. Ideally though the best mitigation by far is to perform regular backups of your data and either store them off-line, or have a version control system.