def reachable?(retry_limit = 3)
timeout = 0.2
able_to_connect = false
attempts = 0
begin
Timeout.timeout(timeout) do
open(@baseurl, :proxy => nil).read
end
able_to_connect = true
rescue OpenURI::HTTPError => e
if e.message.match /404 Not Found/
able_to_connect = false
else
attempts = attempts + 1
retry if attempts < retry_limit
end
rescue Timeout::Error
attempts = attempts + 1
retry if attempts < retry_limit
rescue *CONNECTION_ERRORS
attempts = attempts + 1
retry if attempts < retry_limit
end
able_to_connect
end