module Net::SSH::Test::Extensions::PacketStream
def self.included(base) # :nodoc:
def self.included(base) # :nodoc: base.send :alias_method, :real_available_for_read?, :available_for_read? base.send :alias_method, :available_for_read?, :test_available_for_read? base.send :alias_method, :real_enqueue_packet, :enqueue_packet base.send :alias_method, :enqueue_packet, :test_enqueue_packet base.send :alias_method, :real_poll_next_packet, :poll_next_packet base.send :alias_method, :poll_next_packet, :test_poll_next_packet end
def idle!
script and shoves it onto this IO object, making it available to
script. If the next packet is a remote packet, it pops it off the
Called when another packet should be inspected from the current
def idle! return false unless script.next(:first) if script.next(:first).remote? self.string << script.next.to_s self.pos = pos end return true end
def test_available_for_read?
The testing version of Net::SSH::Transport::PacketStream#available_for_read?.
def test_available_for_read? return true if select_for_read? idle! false end
def test_enqueue_packet(payload)
The testing version of Net::SSH::Transport::PacketStream#enqueued_packet.
def test_enqueue_packet(payload) packet = Net::SSH::Buffer.new(payload.to_s) script.process(packet) end
def test_poll_next_packet
The testing version of Net::SSH::Transport::PacketStream#poll_next_packet.
def test_poll_next_packet return nil if available <= 0 packet = Net::SSH::Buffer.new(read_available(4)) length = packet.read_long Net::SSH::Packet.new(read_available(length)) end