Class Net::SSH::Test::RemotePacket
In: lib/net/ssh/test/remote_packet.rb
lib/net/ssh/test/remote_packet.rb
Parent: Packet

This is a specialization of Net::SSH::Test::Packet for representing mock packets that are received by the local (client) host. These are created automatically by Net::SSH::Test::Script and Net::SSH::Test::Channel by any of the gets_* methods.

Methods

process   process   remote?   remote?   to_s   to_s  

Public Instance methods

The process method should only be called on Net::SSH::Test::LocalPacket packets; if it is attempted on a remote packet, then it is an expectation mismatch (a remote packet was received when a local packet was expected to be sent). This will happen when either your test script (Net::SSH::Test::Script) or your program are wrong.

[Source]

    # File lib/net/ssh/test/remote_packet.rb, line 21
21:     def process(packet)
22:       raise "received packet type #{packet.read_byte} and was not expecting any packet"
23:     end

The process method should only be called on Net::SSH::Test::LocalPacket packets; if it is attempted on a remote packet, then it is an expectation mismatch (a remote packet was received when a local packet was expected to be sent). This will happen when either your test script (Net::SSH::Test::Script) or your program are wrong.

[Source]

    # File lib/net/ssh/test/remote_packet.rb, line 21
21:     def process(packet)
22:       raise "received packet type #{packet.read_byte} and was not expecting any packet"
23:     end

Returns true; this is a remote packet.

[Source]

    # File lib/net/ssh/test/remote_packet.rb, line 12
12:     def remote?
13:       true
14:     end

Returns true; this is a remote packet.

[Source]

    # File lib/net/ssh/test/remote_packet.rb, line 12
12:     def remote?
13:       true
14:     end

Returns this remote packet as a string, suitable for parsing by Net::SSH::Transport::PacketStream and friends. When a remote packet is received, this method is called and the result concatenated onto the input buffer for the packet stream.

[Source]

    # File lib/net/ssh/test/remote_packet.rb, line 29
29:     def to_s
30:       @to_s ||= begin
31:         instantiate!
32:         string = Net::SSH::Buffer.from(:byte, @type, *types.zip(@data).flatten).to_s
33:         [string.length, string].pack("NA*")
34:       end
35:     end

Returns this remote packet as a string, suitable for parsing by Net::SSH::Transport::PacketStream and friends. When a remote packet is received, this method is called and the result concatenated onto the input buffer for the packet stream.

[Source]

    # File lib/net/ssh/test/remote_packet.rb, line 29
29:     def to_s
30:       @to_s ||= begin
31:         instantiate!
32:         string = Net::SSH::Buffer.from(:byte, @type, *types.zip(@data).flatten).to_s
33:         [string.length, string].pack("NA*")
34:       end
35:     end

[Validate]