From f358a3515f948fe6c66586388e0fdd7292493a67 Mon Sep 17 00:00:00 2001 From: usa Date: Mon, 27 Jul 2015 03:22:28 +0000 Subject: commit miss git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/openssl/test_ssl.rb | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'test/openssl') diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb index d714b4010f..232747dffa 100644 --- a/test/openssl/test_ssl.rb +++ b/test/openssl/test_ssl.rb @@ -607,6 +607,14 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase cert end + def socketpair + if defined? UNIXSocket + UNIXSocket.pair + else + Socket.pair(Socket::AF_INET, Socket::SOCK_STREAM, 0) + end + end + def test_servername_cb_sets_context_on_the_socket hostname = 'example.org' @@ -617,7 +625,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase ctx2.ciphers = "DH" ctx2.servername_cb = lambda { |args| ctx3 } - sock1, sock2 = UNIXSocket.pair + sock1, sock2 = socketpair s2 = OpenSSL::SSL::SSLSocket.new(sock2, ctx2) @@ -647,7 +655,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase ctx2.ciphers = "DH" ctx2.servername_cb = lambda { |args| Object.new } - sock1, sock2 = UNIXSocket.pair + sock1, sock2 = socketpair s2 = OpenSSL::SSL::SSLSocket.new(sock2, ctx2) @@ -683,7 +691,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase ctx2.ciphers = "DH" ctx2.servername_cb = lambda { |args| ctx3 } - sock1, sock2 = UNIXSocket.pair + sock1, sock2 = socketpair s2 = OpenSSL::SSL::SSLSocket.new(sock2, ctx2) @@ -712,7 +720,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase ctx2.ciphers = "DH" ctx2.servername_cb = lambda { |args| nil } - sock1, sock2 = UNIXSocket.pair + sock1, sock2 = socketpair s2 = OpenSSL::SSL::SSLSocket.new(sock2, ctx2) @@ -746,7 +754,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase ctx2 end - sock1, sock2 = UNIXSocket.pair + sock1, sock2 = socketpair s2 = OpenSSL::SSL::SSLSocket.new(sock2, ctx2) -- cgit v1.2.3