'Test whether the protocol stream has reached EOF.
Note that this refers to the actual stream EOF and not just a
flush-pkt.
:return: True if the stream is at EOF, False otherwise.'

def eof(self):

    try:
        next_line = self.read_pkt_line()
    except HangupException:
        return True
    self.unread_pkt_line(next_line)
    return False
