This usually happens when you download too large of an area or amount of objects. There’s a setting for the time out timing in JOSM which you can increase to prevent this from happening.
Go to Preferences->Advanced Preferences search for “timeout” and change socket.timeout.connect and socket.timeout.read to a higher value (something like 150 and 300 for them) You might need to check the box “expert mode” to see Advanced Preferences
Hope this helps, Kengoman