248
|
1 |
"{ Package: 'exept:regression' }"
|
|
2 |
|
|
3 |
TestCase subclass:#ServerSocketTest
|
|
4 |
instanceVariableNames:''
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'Streams-External'
|
|
8 |
!
|
|
9 |
|
|
10 |
!ServerSocketTest class methodsFor:'documentation'!
|
|
11 |
|
|
12 |
documentation
|
|
13 |
"
|
|
14 |
documentation to be added.
|
|
15 |
|
|
16 |
[author:]
|
|
17 |
james (james@CHANTI)
|
|
18 |
|
|
19 |
[instance variables:]
|
|
20 |
|
|
21 |
[class variables:]
|
|
22 |
|
|
23 |
[see also:]
|
|
24 |
|
|
25 |
"
|
|
26 |
!
|
|
27 |
|
|
28 |
history
|
|
29 |
"Created: / 21-09-2004 / 14:28:22 / james"
|
|
30 |
! !
|
|
31 |
|
|
32 |
!ServerSocketTest methodsFor:'initialize / release'!
|
|
33 |
|
|
34 |
setUp
|
|
35 |
"common setup - invoked before testing."
|
|
36 |
|
|
37 |
super setUp
|
|
38 |
!
|
|
39 |
|
|
40 |
tearDown
|
|
41 |
"common cleanup - invoked after testing."
|
|
42 |
|
|
43 |
super tearDown
|
|
44 |
! !
|
|
45 |
|
|
46 |
!ServerSocketTest methodsFor:'tests'!
|
|
47 |
|
|
48 |
testServerSocket
|
|
49 |
"Tests if we can open a server socket"
|
|
50 |
|
|
51 |
self shouldnt: [
|
|
52 |
|sock|
|
|
53 |
|
|
54 |
sock := Socket newTCPclientToHost:(OperatingSystem getHostName) port:9998.
|
|
55 |
sock isNil ifTrue:[
|
|
56 |
Transcript showCR:'nope'.
|
|
57 |
Error raise.
|
|
58 |
] ifFalse:[
|
|
59 |
sock buffered:false.
|
|
60 |
Transcript showCR:'client: got it'.
|
|
61 |
'can now do transfer via sock'.
|
|
62 |
Transcript showCR:'sending <hello>'.
|
|
63 |
sock nextPutLine:'hello'.
|
|
64 |
sock close
|
|
65 |
]
|
|
66 |
] raise:Error.
|
|
67 |
|
|
68 |
"
|
|
69 |
self run:#test1
|
|
70 |
self new test1
|
|
71 |
"
|
|
72 |
! !
|
|
73 |
|
|
74 |
!ServerSocketTest class methodsFor:'documentation'!
|
|
75 |
|
|
76 |
version
|
|
77 |
^ '$Header$'
|
|
78 |
! !
|