blob: fef6deaa9129c8ac4a12c914948ce4f50fb1cbbf (
plain)
1
2
3
4
5
6
7
8
9
10
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#
# The TCP-protocol test.
#
# This object is instantiated if the parser sees a line such as:
#
###
### foo.vm.bytemark.co.uk must run tcp on 22 with banner 'ssh' otherwise 'ssh fail'.
###
#
# The specification of the port is mandatory, the banner is optional.
#
class TCPTest < ProtocolTest
#
# Constructor
#
# Ensure we received a port to run the TCP-test against.
#
def initialize( line )
raise ArgumentError, "Missing port" unless ( line =~ /on\s+([0-9]+)/ );
@error = nil
end
#
# Helper for development.
#
def display
puts "I'm a TCP-test!"
end
#
# Run the TCP-protocol test.
#
def run_test
# reset the error, in case we were previously executed.
@error = nil
end
#
# If the test fails then report the error.
#
def error
@error
end
register_test_type "tcp"
end
|