Class: Rex::Socket::SslTcp::UnitTest

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/rex/socket/ssl_tcp.rb.ut.rb

Instance Method Summary collapse

Instance Method Details

#test_ssltcpObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/rex/socket/ssl_tcp.rb.ut.rb', line 11

def test_ssltcp

	# Create an SslTcp instance
	t = nil
	assert_nothing_raised {
		t = Rex::Socket::SslTcp.create(
			'PeerHost' => 'www.google.com',
			'PeerPort' => 443)
	}
	assert_kind_of(Rex::Socket::SslTcp, t, "valid ssl tcp")

	# Send a HEAD request and make sure we get some kind of response
	head_request = "HEAD / HTTP/1.0\r\n\r\n"

	assert_equal(19, t.put(head_request), "sending head request")

	head_response = ""

	assert_nothing_raised {
		head_response = t.get(nil) || ""
	}

	assert_match(/^HTTP\/1./, head_response, "valid head response")

	assert_nothing_raised {
		t.close
	}
end