lib/toxiproxy.rb in toxiproxy-0.1.2 vs lib/toxiproxy.rb in toxiproxy-0.1.3

- old
+ new

@@ -96,9 +96,16 @@ end self.create(proxy) unless existing }.compact end + def self.running? + TCPSocket.new(URI.host, URI.port).close + true + rescue Errno::ECONNREFUSED, Errno::ECONNRESET + false + end + # Set an upstream toxic. def upstream(toxic = nil, attrs = {}) return @upstream unless toxic collection = ToxicCollection.new([self])