Module: Cukunity::Android::TunnelClientMethods

Includes:
Utils
Included in:
MonkeyClient, Unity::Client
Defined in:
lib/cukunity/drivers/android/tunnel_client_methods.rb

Instance Method Summary collapse

Methods included from Utils

#adb, #launchable_activity_name, #monkey, #package_name, #shell

Methods included from Utils

#check_timeout, #merge_options, #restrict_options, #to_options, #wait_connectivity

Instance Method Details

#close_tunnelObject



16
17
18
19
# File 'lib/cukunity/drivers/android/tunnel_client_methods.rb', line 16

def close_tunnel
  # FIXME: remove tunnel
  @tunnel = nil
end

#open_tunnel(lport, rport) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/cukunity/drivers/android/tunnel_client_methods.rb', line 6

def open_tunnel(lport, rport)
  return @tunnel if @tunnel == [lport, rport]
  # create tunnel to device
  output, status = adb ['forward', "tcp:#{lport.to_i}", "tcp:#{rport.to_i}"]
  unless status.exited? and status.exitstatus == 0
    raise Exception::TunnelError.new
  end
  @tunnel = [lport, rport]
end