Sha256: 82338d40357da2fa315fee3876c728d6eef6fa3400ce727e1d24c09976baa79f

Contents?: true

Size: 429 Bytes

Versions: 12

Compression:

Stored size: 429 Bytes

Contents

require 'timeout'
require 'socket'

class TCPSocket
  
  def self.wait_for_service(options)
    socket = nil
    Timeout::timeout(options[:timeout] || 20) do
      loop do
        begin
          socket = TCPSocket.new(options[:host], options[:port])
          return
        rescue Errno::ECONNREFUSED
          puts ".\n"
          sleep 2
        end
      end
    end
  ensure
    socket.close unless socket.nil?
  end
  
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
selenium-rspec-dsl-1.0.2 vendor/selenium-grid-1.0.4/lib/ruby/tcp_socket_extensions.rb
selenium-client-1.2 lib/tcp_socket_extension.rb
selenium-client-1.2.4 lib/tcp_socket_extension.rb
selenium-client-1.2.8 lib/tcp_socket_extension.rb
selenium-client-1.2.2 lib/tcp_socket_extension.rb
selenium-client-1.2.9 lib/tcp_socket_extension.rb
selenium-client-1.2.3 lib/tcp_socket_extension.rb
selenium-client-1.2.1 lib/tcp_socket_extension.rb
selenium-client-1.2.6 lib/tcp_socket_extension.rb
selenium-client-1.2.5 lib/tcp_socket_extension.rb
selenium-client-1.2.7 lib/tcp_socket_extension.rb
selenium-client-1.2.10 lib/tcp_socket_extension.rb