This is a sketch that implements the "contrived protocol". The contrived protocol only understands one kind of message which is a single byte, namely 0xff. When the device receives the 0xff message it must respond with a message 0xff.
Incoming messages don't have any header's or footers.
Outgoing messages must end with 0x00 byte.
So basically the only transaction that can happen is:
Host: 0xff
Dev: 0xff 0x00