Module: Cukunity::IOS::TunnelClientMethods
- Includes:
- Utils
- Included in:
- Unity::Client
- Defined in:
- lib/cukunity/drivers/iOS/tunnel_client_methods.rb
Constant Summary
Constants included from Utils
Utils::MOBILE_DEVICE_DEFAULT_TIMEOUT
Instance Method Summary collapse
Methods included from Utils
#bundle_identifier, #device_udid, #mobile_device_cmd, #uiautomation_cmd, #unity_command
Methods included from Utils
#check_timeout, #merge_options, #restrict_options, #to_options, #wait_connectivity
Instance Method Details
#close_tunnel ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/cukunity/drivers/iOS/tunnel_client_methods.rb', line 17 def close_tunnel @tunnel = nil unless @mobiledevice_pipe.nil? ::Process.kill('KILL', @mobiledevice_pipe.pid) rescue ::Exception @mobiledevice_pipe.close rescue ::Exception @mobiledevice_pipe = nil end end |
#open_tunnel(lport, rport) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/cukunity/drivers/iOS/tunnel_client_methods.rb', line 6 def open_tunnel(lport, rport) return @tunnel if lport == 0 and !@tunnel.nil? # create tunnel to device @mobiledevice_pipe = mobile_device_cmd(['tunnel', lport.to_s, rport.to_s, :err => [:child, :out]], :wait => false) output = @mobiledevice_pipe.readline match = output.match(/^Tunneling from local port (\d+) to device port/) raise Exception::TunnelError.new(output) if match.nil? lport = match[1].to_i @tunnel = [lport, rport] end |