Skip to content

Commit

Permalink
Change test to negotiate sucessfully on a readonly buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoPolo committed Jun 24, 2022
1 parent 4dc1fac commit 4578c57
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions multistream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ func (rob *readonlyBuffer) Close() error {
return nil
}

func TestNegotiateFail(t *testing.T) {
func TestNegotiatThenWriteFail(t *testing.T) {
buf := new(bytes.Buffer)

err := delimWrite(buf, []byte(ProtocolID))
Expand All @@ -683,9 +683,15 @@ func TestNegotiateFail(t *testing.T) {

rob := &readonlyBuffer{bytes.NewReader(buf.Bytes())}
_, _, err = mux.Negotiate(rob)
if err != nil {
t.Fatal("Negotiate should not fail here")
}

_, err = rob.Write([]byte("app data"))
if err == nil {
t.Fatal("Negotiate should fail here")
t.Fatal("Write should fail here")
}

}

type mockStream struct {
Expand Down

0 comments on commit 4578c57

Please sign in to comment.