2
0
mirror of https://github.com/soheilhy/cmux.git synced 2024-09-21 03:16:43 +08:00

Add test for multiple matchers

This commit is contained in:
Yuki Ito 2018-01-24 02:15:21 +09:00 committed by Soheil Hassas Yeganeh
parent cfc68f9888
commit 444ce56efe

View File

@ -622,6 +622,35 @@ func TestErrorHandler(t *testing.T) {
}
}
func TestMultipleMatchers(t *testing.T) {
defer leakCheck(t)()
errCh := make(chan error)
defer func() {
select {
case err := <-errCh:
t.Fatal(err)
default:
}
}()
l, cleanup := testListener(t)
defer cleanup()
matcher := func(r io.Reader) bool {
return true
}
unmatcher := func(r io.Reader) bool {
return false
}
muxl := New(l)
lis := muxl.Match(unmatcher, matcher, unmatcher)
go runTestHTTPServer(errCh, lis)
go safeServe(errCh, muxl)
runTestHTTP1Client(t, l.Addr())
}
func TestClose(t *testing.T) {
defer leakCheck(t)()
errCh := make(chan error)