module Net::SSH::Test::Extensions::PacketStream

def test_poll_next_packet

Reads the next available packet from the IO object and returns it.
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