File tree 1 file changed +7
-3
lines changed
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -1675,9 +1675,13 @@ mod tests {
1675
1675
1676
1676
#[ test]
1677
1677
fn connect_timeout_unroutable ( ) {
1678
- // this IP is unroutable, so connections should always time out,
1679
- // provided the network is reachable to begin with.
1680
- let addr = "10.255.255.1:80" . parse ( ) . unwrap ( ) ;
1678
+ // We want an IP address that is always unreachable and will trigger a
1679
+ // timeout, regardless of whether a network connection is available or
1680
+ // not. IPv4 doesn't have any address that is guaranteed to be
1681
+ // unreachable, but 192.0.2.0 is part of the TEST-NET-1 address block,
1682
+ // which is reserved for documentation and examples, and so is very
1683
+ // likely to be unreachable.
1684
+ let addr = "192.0.2.0:80" . parse ( ) . unwrap ( ) ;
1681
1685
let e = TcpStream :: connect_timeout ( & addr, Duration :: from_millis ( 250 ) ) . unwrap_err ( ) ;
1682
1686
assert ! ( e. kind( ) == io:: ErrorKind :: TimedOut ||
1683
1687
e. kind( ) == io:: ErrorKind :: Other ,
You can’t perform that action at this time.
0 commit comments