@@ -214,9 +214,15 @@ func doTestTimeout(t *testing.T, timeout time.Duration) {
214
214
_ , err := DialWithDialer (& net.Dialer {
215
215
Timeout : timeout ,
216
216
}, "tcp" , ADDR , false , nil )
217
+
217
218
assert .Error (t , err , "There should have been a problem dialing" , timeout )
219
+
218
220
if err != nil {
219
- assert .True (t , err .(net.Error ).Timeout (), "Dial error should be timeout" , timeout )
221
+ if neterr , isNetError := err .(net.Error ); isNetError {
222
+ assert .True (t , neterr .Timeout (), "Dial error should be timeout" , timeout )
223
+ } else {
224
+ t .Fatal (err )
225
+ }
220
226
}
221
227
}
222
228
@@ -230,9 +236,15 @@ func TestDeadlineBeforeTimeout(t *testing.T) {
230
236
Timeout : 500 * time .Second ,
231
237
Deadline : time .Now ().Add (5 * time .Microsecond ),
232
238
}, "tcp" , ADDR , false , nil )
239
+
233
240
assert .Error (t , err , "There should have been a problem dialing" )
241
+
234
242
if err != nil {
235
- assert .True (t , err .(net.Error ).Timeout (), "Dial error should be timeout" )
243
+ if neterr , isNetError := err .(net.Error ); isNetError {
244
+ assert .True (t , neterr .Timeout (), "Dial error should be timeout" )
245
+ } else {
246
+ t .Fatal (err )
247
+ }
236
248
}
237
249
238
250
closeAndCountFDs (t , conn , err , fdc )
0 commit comments