If you are using a software firewall, like the Windows Firewall, then temporarily disable it and try again.
If it now works, then you now know that you have to give the game permission to pass through your firewall, or open ports in your firewall.
If it is disabled and still doesn't work, then go through the port forwarding procedures (for your router/modem)
detailed here
Added Note: A friend of mine had this problem when he first bought the game. He was fine in the lobby, then during the loading of the game, when you are meant to appear in the garage at the end of the process, he would disconnect every time.
When talking to him about this as it was happening, I discovered that he was
way behind me as each loading screen appears. Then when I was in the garage waiting for him, he was still a long way back at one of the earlier screens. It looked like the connection was timing out just as he was appearing in the garage. Very frustrating.
He was using an old tri-core cpu at the time, which he later upgraded. After the upgrade he had no problems, the game loaded faster, he had not changed anything else
I am not saying change your CPU, I am just pointing out that there could be many reasons, and if your system is a bit 'minimal', on the low end of the specs, then it
can effect such things