File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -50,14 +50,15 @@ async fn test_handshake_with_mainnet_peer() {
5050
5151#[ tokio:: test]
5252async fn test_handshake_timeout ( ) {
53- // Test connecting to a non-routable IP to verify timeout behavior
54- // Using a non-routable IP that will cause the connection to hang
55- let peer_addr: SocketAddr = "10.255.255.1:9999" . parse ( ) . expect ( "Valid peer address" ) ;
53+ // Test connection timeout behavior using TEST-NET-1 from RFC 5737.
54+ // https://datatracker.ietf.org/doc/html/rfc5737
55+ // This IP range is reserved for documentation and will never respond.
56+ let peer_addr: SocketAddr = "192.0.2.1:9999" . parse ( ) . expect ( "Valid peer address" ) ;
5657 let start = std:: time:: Instant :: now ( ) ;
5758 let result = Peer :: connect ( peer_addr, 2 , Network :: Dash ) . await ;
5859 let elapsed = start. elapsed ( ) ;
5960
60- assert ! ( result. is_err( ) , "Connection should fail for non-routable peer" ) ;
61+ assert ! ( result. is_err( ) , "Connection should fail for unreachable peer" ) ;
6162 assert ! (
6263 elapsed >= Duration :: from_secs( 1 ) ,
6364 "Should respect timeout duration (elapsed: {:?})" ,
You can’t perform that action at this time.
0 commit comments