I encountered while trying to update ruby gem and took my more than 1 hour to search for the solution and have to go through lots of blogs and scroll through the comments to finally get the right answer.
When i did gem update --system then i got the following error:
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
A connection attempt failed because the connected party did not properly res
pond after a period of time, or established connection failed because connected
host has failed to respond. - connect(2) (Errno::ETIMEDOUT)
getting size of http://gems.rubyforge.org/Marshal.4.8
Solution
So this might be due to the connection to the site or the proxy problem
1 Go to your IE Internet options/connections/Lan Settings/
2. Check your proxy and its port
3. go to Command prompt and do
set http_proxy=http://proxy:port
Now do gem update --system
Should work now.....
Read more!