@@ -1111,7 +1111,7 @@ def test_verify_hostname_on_connect
1111
1111
ssl . connect
1112
1112
ssl . puts "abc" ; assert_equal "abc\n " , ssl . gets
1113
1113
else
1114
- assert_handshake_error { ssl . connect }
1114
+ assert_raise ( OpenSSL :: SSL :: SSLError ) { ssl . connect }
1115
1115
end
1116
1116
ensure
1117
1117
ssl . close if ssl
@@ -1149,7 +1149,7 @@ def test_verify_hostname_failure_error_code
1149
1149
sock = TCPSocket . new ( "127.0.0.1" , port )
1150
1150
ssl = OpenSSL ::SSL ::SSLSocket . new ( sock , ctx )
1151
1151
ssl . hostname = "b.example.com"
1152
- assert_handshake_error { ssl . connect }
1152
+ assert_raise ( OpenSSL :: SSL :: SSLError ) { ssl . connect }
1153
1153
assert_equal false , verify_callback_ok
1154
1154
assert_equal OpenSSL ::X509 ::V_ERR_HOSTNAME_MISMATCH , verify_callback_err
1155
1155
ensure
@@ -1250,7 +1250,7 @@ def test_set_params_min_version
1250
1250
start_server ( ctx_proc : ctx_proc , ignore_listener_error : true ) { |port |
1251
1251
ctx = OpenSSL ::SSL ::SSLContext . new
1252
1252
ctx . set_params ( cert_store : store , verify_hostname : false )
1253
- assert_handshake_error { server_connect ( port , ctx ) { } }
1253
+ assert_raise ( OpenSSL :: SSL :: SSLError ) { server_connect ( port , ctx ) }
1254
1254
}
1255
1255
end
1256
1256
end
@@ -1283,7 +1283,7 @@ def test_minmax_version
1283
1283
ssl . puts "abc" ; assert_equal "abc\n " , ssl . gets
1284
1284
}
1285
1285
else
1286
- assert_handshake_error { server_connect ( port , ctx1 ) { } }
1286
+ assert_raise ( OpenSSL :: SSL :: SSLError ) { server_connect ( port , ctx1 ) }
1287
1287
end
1288
1288
1289
1289
# There is no version-specific SSL methods for TLS 1.3
@@ -1297,7 +1297,7 @@ def test_minmax_version
1297
1297
ssl . puts "abc" ; assert_equal "abc\n " , ssl . gets
1298
1298
}
1299
1299
else
1300
- assert_handshake_error { server_connect ( port , ctx2 ) { } }
1300
+ assert_raise ( OpenSSL :: SSL :: SSLError ) { server_connect ( port , ctx2 ) }
1301
1301
end
1302
1302
end
1303
1303
end
@@ -1338,7 +1338,7 @@ def test_minmax_version
1338
1338
ssl . puts "abc" ; assert_equal "abc\n " , ssl . gets
1339
1339
}
1340
1340
else
1341
- assert_handshake_error { server_connect ( port , ctx2 ) { } }
1341
+ assert_raise ( OpenSSL :: SSL :: SSLError ) { server_connect ( port , ctx2 ) }
1342
1342
end
1343
1343
end
1344
1344
}
@@ -1357,7 +1357,7 @@ def test_minmax_version
1357
1357
ssl . puts "abc" ; assert_equal "abc\n " , ssl . gets
1358
1358
}
1359
1359
else
1360
- assert_handshake_error { server_connect ( port , ctx1 ) { } }
1360
+ assert_raise ( OpenSSL :: SSL :: SSLError ) { server_connect ( port , ctx1 ) }
1361
1361
end
1362
1362
1363
1363
# Client sets max_version
@@ -1489,7 +1489,7 @@ def test_options_disable_versions
1489
1489
# Client only supports TLS 1.2
1490
1490
ctx1 = OpenSSL ::SSL ::SSLContext . new
1491
1491
ctx1 . min_version = ctx1 . max_version = OpenSSL ::SSL ::TLS1_2_VERSION
1492
- assert_handshake_error { server_connect ( port , ctx1 ) { } }
1492
+ assert_raise ( OpenSSL :: SSL :: SSLError ) { server_connect ( port , ctx1 ) }
1493
1493
1494
1494
# Client only supports TLS 1.3
1495
1495
ctx2 = OpenSSL ::SSL ::SSLContext . new
@@ -1505,7 +1505,7 @@ def test_options_disable_versions
1505
1505
# Client doesn't support TLS 1.2
1506
1506
ctx1 = OpenSSL ::SSL ::SSLContext . new
1507
1507
ctx1 . options |= OpenSSL ::SSL ::OP_NO_TLSv1_2
1508
- assert_handshake_error { server_connect ( port , ctx1 ) { } }
1508
+ assert_raise ( OpenSSL :: SSL :: SSLError ) { server_connect ( port , ctx1 ) }
1509
1509
1510
1510
# Client supports TLS 1.2 by default
1511
1511
ctx2 = OpenSSL ::SSL ::SSLContext . new
@@ -1654,7 +1654,7 @@ def test_npn_selected_protocol_too_long
1654
1654
ctx = OpenSSL ::SSL ::SSLContext . new
1655
1655
ctx . max_version = :TLS1_2
1656
1656
ctx . npn_select_cb = -> ( protocols ) { "a" * 256 }
1657
- assert_handshake_error { server_connect ( port , ctx ) }
1657
+ assert_raise ( OpenSSL :: SSL :: SSLError ) { server_connect ( port , ctx ) }
1658
1658
}
1659
1659
end
1660
1660
0 commit comments