I'd like to write tests for a simple byte-oriented protocol using something like Expect. The test scripts would look like a plain stream of:
send "data"
expect "data"
(Where send writes to stdout and expect reads just enough from stdin, exiting if it doesn't match.)
I can't use expect itself because it is designed for buffered, line-oriented interactions. Pattern-matching with grep or awk is out for the same reason.
Is there a UNIX tool or library I can use? Even better if it is standard and portable, as it needs to integrate with an existing program.