mirror of
https://github.com/soheilhy/cmux.git
synced 2026-08-04 07:00:50 +08:00
Merge pull request #23 from soheilhy/bytes-buffer
Replace TeeReader with a bytes buffer
This commit is contained in:
@@ -284,7 +284,13 @@ func TestHTTP2(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var b [len(http2.ClientPreface)]byte
|
||||
if _, err := muxedConn.Read(b[:]); err != io.EOF {
|
||||
var n int
|
||||
// We have the sniffed buffer first...
|
||||
if n, err = muxedConn.Read(b[:]); err == io.EOF {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// and then we read from the source.
|
||||
if _, err = muxedConn.Read(b[n:]); err != io.EOF {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if string(b[:]) != http2.ClientPreface {
|
||||
|
||||
Reference in New Issue
Block a user