equal
deleted
inserted
replaced
1 "{ Package: 'exept:regression' }" |
1 "{ Package: 'stx:goodies/regression' }" |
2 |
2 |
3 "{ NameSpace: RegressionTests }" |
3 "{ NameSpace: RegressionTests }" |
4 |
4 |
5 TestCase subclass:#SocketTests |
5 TestCase subclass:#SocketTests |
6 instanceVariableNames:'' |
6 instanceVariableNames:'' |
17 |
17 |
18 host := 'www.exept.de'. |
18 host := 'www.exept.de'. |
19 port := 80. |
19 port := 80. |
20 n1 := n2 := 0. |
20 n1 := n2 := 0. |
21 |
21 |
22 p1 := |
22 p1 := |
23 [ |
23 [ |
24 [true] whileTrue:[ |
24 [true] whileTrue:[ |
25 sock := Socket newTCPclientToAddress:host port:port. |
25 sock := Socket newTCPclientToAddress:host port:port. |
26 Processor yield. |
26 Processor yield. |
27 n1 := n1 + 1. |
27 n1 := n1 + 1. |
28 sock close |
28 sock close |
29 ] |
29 ] |
30 ] newProcess. |
30 ] newProcess. |
31 |
31 |
32 p2 := |
32 p2 := |
33 [ |
33 [ |
34 [true] whileTrue:[ |
34 [true] whileTrue:[ |
35 sock := Socket newTCPclientToAddress:host port:port. |
35 sock := Socket newTCPclientToAddress:host port:port. |
36 Processor yield. |
36 Processor yield. |
37 n2 := n2 + 1. |
37 n2 := n2 + 1. |
38 sock close |
38 sock close |
39 ] |
39 ] |
40 ] newProcess. |
40 ] newProcess. |
41 |
41 |
42 p1 resume. |
42 p1 resume. |
43 p2 resume. |
43 p2 resume. |
44 |
44 |
45 Delay waitForSeconds:20. |
45 Delay waitForSeconds:20. |
58 |p1 p2 sock port n1 n2| |
58 |p1 p2 sock port n1 n2| |
59 |
59 |
60 port := 80. |
60 port := 80. |
61 n1 := n2 := 0. |
61 n1 := n2 := 0. |
62 |
62 |
63 p1 := |
63 p1 := |
64 [ |
64 [ |
65 |host| |
65 |host| |
66 |
66 |
67 [true] whileTrue:[ |
67 [true] whileTrue:[ |
68 host := 'www.nonexisting-%1.de' bindWith:(UUID genRandomUUID). |
68 host := 'www.nonexisting-%1.de' bindWith:(UUID genRandomUUID). |
69 HostNameLookupError handle:[:ex | |
69 HostNameLookupError handle:[:ex | |
70 ] do:[ |
70 ] do:[ |
71 sock := Socket newTCPclientToAddress:host port:port. |
71 sock := Socket newTCPclientToAddress:host port:port. |
72 Processor yield. |
72 Processor yield. |
73 n1 := n1 + 1. |
73 n1 := n1 + 1. |
74 sock close |
74 sock close |
75 ]. |
75 ]. |
76 ] |
76 ] |
77 ] newProcess. |
77 ] newProcess. |
78 |
78 |
79 p2 := |
79 p2 := |
80 [ |
80 [ |
81 |host| |
81 |host| |
82 |
82 |
83 [true] whileTrue:[ |
83 [true] whileTrue:[ |
84 host := 'www.nonexisting-%1.de' bindWith:(UUID genRandomUUID). |
84 host := 'www.nonexisting-%1.de' bindWith:(UUID genRandomUUID). |
85 HostNameLookupError handle:[:ex | |
85 HostNameLookupError handle:[:ex | |
86 ] do:[ |
86 ] do:[ |
87 sock := Socket newTCPclientToAddress:host port:port. |
87 sock := Socket newTCPclientToAddress:host port:port. |
88 Processor yield. |
88 Processor yield. |
89 n2 := n2 + 1. |
89 n2 := n2 + 1. |
90 sock close |
90 sock close |
91 ] |
91 ] |
92 ] |
92 ] |
93 ] newProcess. |
93 ] newProcess. |
94 |
94 |
95 p1 resume. |
95 p1 resume. |
96 p2 resume. |
96 p2 resume. |
97 |
97 |
98 Delay waitForSeconds:20. |
98 Delay waitForSeconds:20. |
110 "fails on MAC-osx" |
110 "fails on MAC-osx" |
111 |
111 |
112 |addr hostNameFromOS nm| |
112 |addr hostNameFromOS nm| |
113 |
113 |
114 OperatingSystem isUNIXlike ifTrue:[ |
114 OperatingSystem isUNIXlike ifTrue:[ |
115 hostNameFromOS := PipeStream outputFromCommand:'hostname'. |
115 hostNameFromOS := PipeStream outputFromCommand:'hostname'. |
116 ]. |
116 ]. |
117 |
117 |
118 addr := IPSocketAddress localHost. |
118 addr := IPSocketAddress localHost. |
119 self assert:(addr hostAddress = #[127 0 0 1]). |
119 self assert:(addr hostAddress = #[127 0 0 1]). |
120 |
120 |
121 nm := addr hostName. |
121 nm := addr hostName. |
122 self assert:(nm notEmptyOrNil). |
122 self assert:(nm notEmptyOrNil). |
123 |
123 |
124 addr := IPSocketAddress addressString:'127.0.0.1'. |
124 addr := IPSocketAddress addressString:'127.0.0.1'. |
125 self assert:(addr hostAddress = #[127 0 0 1]). |
125 self assert:(addr hostAddress = #[127 0 0 1]). |
126 addr port:51121. |
126 addr port:51121. |
127 nm := addr hostName. |
127 nm := addr hostName. |
128 self assert:(nm notEmptyOrNil). |
128 self assert:(nm notEmptyOrNil). |
129 self assert:(addr hostAddress = #[127 0 0 1]). |
129 self assert:(addr hostAddress = #[127 0 0 1]). |
130 self assert:(addr port = 51121). |
130 self assert:(addr port = 51121). |
131 ! ! |
131 ! ! |