diff --git a/grpcall_test.go b/grpcall_test.go index bba6ce0..0175eaf 100644 --- a/grpcall_test.go +++ b/grpcall_test.go @@ -92,6 +92,9 @@ func TestInvokeBidiStream(t *testing.T) { flag := make(chan bool) go func() { + timer := time.NewTimer(time.Second) + defer timer.Stop() + for { select { case msg := <-recv: @@ -102,9 +105,11 @@ func TestInvokeBidiStream(t *testing.T) { } flag <- true return - case <-time.After(time.Second): + case <-timer.C: resp.Cancel() + timer.Reset(time.Second) } + } }()