module EventMachine::Connectify

Public Instance Methods

connect_hook() click to toggle source
# File lib/em-socksify/connectify.rb, line 19
def connect_hook
  extend CONNECT

  class << self
    alias receive_data connect_receive_data
  end
end
connect_receive_data(data) click to toggle source
# File lib/em-socksify/connectify.rb, line 35
def connect_receive_data(data)
  @connect_data << data
  connect_parse_response
end
connect_unhook() click to toggle source
# File lib/em-socksify/connectify.rb, line 27
def connect_unhook
  class << self
    remove_method :receive_data
  end

  @connect_deferrable.succeed
end
connectify(host, port, username=nil, password=nil, &blk) click to toggle source
# File lib/em-socksify/connectify.rb, line 4
def connectify(host, port, username=nil, password=nil, &blk)
  @connect_target_host = host
  @connect_target_port = port
  @connect_username = username
  @connect_password = password
  @connect_data = ''

  connect_hook
  connect_send_handshake

  @connect_deferrable = DefaultDeferrable.new
  @connect_deferrable.callback(&blk) if blk
  @connect_deferrable
end