@@ -442,6 +442,7 @@ def now
442
442
it "should use ssl if it enabled using the :ssl => true parameter" do
443
443
expect(OpenSSL::SSL::SSLSocket).to receive(:new).and_return(ssl_socket)
444
444
expect(ssl_socket).to receive(:connect)
445
+ expect(ssl_socket).to receive(:post_connection_check).with('mqtt.example.com')
445
446
446
447
client = MQTT::Client.new('mqtt.example.com', :ssl => true)
447
448
allow(client).to receive(:receive_connack)
@@ -451,6 +452,7 @@ def now
451
452
it "should use ssl if it enabled using the mqtts:// scheme" do
452
453
expect(OpenSSL::SSL::SSLSocket).to receive(:new).and_return(ssl_socket)
453
454
expect(ssl_socket).to receive(:connect)
455
+ expect(ssl_socket).to receive(:post_connection_check).with('mqtt.example.com')
454
456
455
457
client = MQTT::Client.new('mqtts://mqtt.example.com')
456
458
allow(client).to receive(:receive_connack)
@@ -460,6 +462,7 @@ def now
460
462
it "should use set the SSL version, if the :ssl parameter is a symbol" do
461
463
expect(OpenSSL::SSL::SSLSocket).to receive(:new).and_return(ssl_socket)
462
464
expect(ssl_socket).to receive(:connect)
465
+ expect(ssl_socket).to receive(:post_connection_check).with('mqtt.example.com')
463
466
464
467
client = MQTT::Client.new('mqtt.example.com', :ssl => :TLSv1)
465
468
expect(client.ssl_context).to receive('ssl_version=').with(:TLSv1)
@@ -470,11 +473,21 @@ def now
470
473
it "should use set hostname on the SSL socket for SNI" do
471
474
expect(OpenSSL::SSL::SSLSocket).to receive(:new).and_return(ssl_socket)
472
475
expect(ssl_socket).to receive(:hostname=).with('mqtt.example.com')
476
+ expect(ssl_socket).to receive(:post_connection_check).with('mqtt.example.com')
473
477
474
478
client = MQTT::Client.new('mqtts://mqtt.example.com')
475
479
allow(client).to receive(:receive_connack)
476
480
client.connect
477
481
end
482
+
483
+ it "should skip host verification" do
484
+ expect(OpenSSL::SSL::SSLSocket).to receive(:new).and_return(ssl_socket)
485
+ expect(ssl_socket).to receive(:connect)
486
+
487
+ client = MQTT::Client.new('mqtt.example.com', :ssl => true, :verify_host => false)
488
+ allow(client).to receive(:receive_connack)
489
+ client.connect
490
+ end
478
491
end
479
492
480
493
context "with a last will and testament set" do
0 commit comments