Utilizing the libp2p-multistream select spec, add conformance testing with expected behavior:
For example:
- R1: recv HEADER + /known/1\n → reply HEADER + /known/1\n, stream is now negotiated.
- R2 (your test 1): recv HEADER + /unknown\n → reply HEADER(once) + na\n, keep the stream open and wait for the next proto frame.
- R3: after na, recv /known/1\n → echo it, negotiated. (multi-round must work.)
- R4: after na, peer just closes → clean shutdown, no panic.
- R5: recv ls\n → either respond with protocol list or na\n; must not close.
- R6: recv /known/1\n without leading header → close.
- R7: recv HEADER + /known/1\n immediately followed (same TCP write) by application bytes → after echo, those bytes are surfaced to the upper layer (pipelining / optimistic-send).
- R8: proto name with / and digits but no \n inside the frame payload — boundary case: only the trailing \n is the terminator; embedded \n → reject.
Utilizing the libp2p-multistream select spec, add conformance testing with expected behavior:
For example: