Skip to content

Commit dc4d323

Browse files
committed
[test] adjust and add some integration checks
1 parent a899302 commit dc4d323

2 files changed

Lines changed: 20 additions & 8 deletions

File tree

src/test/integration/Gemfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,3 @@ source 'https://rubygems.org'
22

33
gem 'httpclient', :require => false
44
gem 'trocla', '~> 0.2.3', :require => false
5-
6-
group :development do
7-
gem 'rake', '< 12', :require => nil # due JRuby 1.7 (1.9.3)
8-
end

src/test/integration/ssl_test.rb

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,22 @@ def test_connect_net_http_1
3838
puts http.get('/')
3939
end
4040

41+
def test_connect_net_http_2
42+
require 'uri'; require 'net/https'
43+
44+
puts "\n"
45+
puts "------------------------------------------------------------"
46+
puts "-- Net::HTTP.new ... 'https://fancyssl.hboeck.de'"
47+
puts "------------------------------------------------------------"
48+
49+
uri = URI.parse('https://fancyssl.hboeck.de/')
50+
51+
http = Net::HTTP.new(uri.host, uri.port)
52+
http.use_ssl = true
53+
http.ssl_version = :TLSv1_2
54+
puts http.get('/')
55+
end
56+
4157
def test_connect_ssl_minmax_version
4258
require 'openssl'
4359
require 'socket'
@@ -48,16 +64,16 @@ def test_connect_ssl_minmax_version
4864
puts "------------------------------------------------------------"
4965

5066
ctx = OpenSSL::SSL::SSLContext.new()
51-
ctx.min_version = OpenSSL::SSL::TLS1_VERSION
52-
ctx.max_version = OpenSSL::SSL::TLS1_1_VERSION
67+
ctx.min_version = OpenSSL::SSL::TLS1_1_VERSION
68+
ctx.max_version = OpenSSL::SSL::TLS1_2_VERSION
5369
client = TCPSocket.new('google.co.uk', 443)
5470
ssl = OpenSSL::SSL::SSLSocket.new(client, ctx)
5571
ssl.sync_close = true
5672
ssl.connect
5773
begin
58-
assert_equal 'TLSv1.1', ssl.ssl_version
74+
assert_equal 'TLSv1.2', ssl.ssl_version
5975
ensure
60-
ssl.sysclose
76+
ssl.sysclose
6177
end
6278
end
6379
end

0 commit comments

Comments
 (0)