Module: Cukunity::RequestLineResponseClientMethods
- Includes:
- Utils
- Included in:
- Android::MonkeyClient, Unity::ClientMethods
- Defined in:
- lib/cukunity/request_line_response_client_methods.rb
Constant Summary collapse
- DEFAULT_TIMEOUT =
30
Instance Method Summary collapse
Methods included from Utils
#check_timeout, #merge_options, #restrict_options, #to_options, #wait_connectivity
Instance Method Details
#request(line, options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/cukunity/request_line_response_client_methods.rb', line 9 def request(line, = {}) = (, { :max_time => DEFAULT_TIMEOUT, :quit => false, :retry => true }) connect response = nil begin raise Exception::MobileDeviceTimeout.new(cmd) if check_timeout([:max_time]) do @socket.puts(line) @socket.flush return if [:quit] response = @socket.gets break unless response.nil? and [:retry] close sleep 0.1 connect false end rescue Errno::ECONNRESET return if [:quit] close if [:retry] connect retry end rescue Errno::EPIPE return if [:quit] close if [:retry] connect retry end end if block_given? yield response else response end end |