mirror of
https://github.com/xtaci/smux.git
synced 2024-04-21 10:51:48 +00:00
all cover for writeFrameWithDeadline
This commit is contained in:
@@ -645,6 +645,29 @@ func TestDeadlineFrame(t *testing.T) {
|
||||
}
|
||||
cli.Close()
|
||||
|
||||
{
|
||||
cli, err = net.Dial("tcp", addr)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
config := DefaultConfig()
|
||||
config.KeepAliveInterval = time.Second
|
||||
config.KeepAliveTimeout = 2 * time.Second
|
||||
session, _ = Client(&blockWriteConn{cli}, config)
|
||||
f := newFrame(byte(rand.Uint32()), rand.Uint32())
|
||||
c := make(chan time.Time)
|
||||
go func() {
|
||||
//die first, deadline second, better for coverage
|
||||
time.Sleep(time.Second)
|
||||
session.Close()
|
||||
time.Sleep(time.Second)
|
||||
close(c)
|
||||
}()
|
||||
_, err = session.writeFrameWithDeadline(f, c)
|
||||
if err.Error() != errBrokenPipe {
|
||||
t.Fatal("write frame with deadline failed", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestReadDeadline(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user