Merge pull request #490 from iamqizhao/master

Specialize connection error handling
diff --git a/stream.go b/stream.go
index 0ee572c..537d4b3 100644
--- a/stream.go
+++ b/stream.go
@@ -133,8 +133,12 @@
 	// Listen on ctx.Done() to detect cancellation when there is no pending
 	// I/O operations on this stream.
 	go func() {
-		<-s.Context().Done()
-		cs.closeTransportStream(transport.ContextErr(s.Context().Err()))
+		select {
+		case <-t.Error():
+			// Incur transport error, simply exit.
+		case <-s.Context().Done():
+			cs.closeTransportStream(transport.ContextErr(s.Context().Err()))
+		}
 	}()
 	return cs, nil
 }