RegressionTests__ServerSocketTest.st
author Claus Gittinger <cg@exept.de>
Tue, 09 Jul 2019 18:53:03 +0200
changeset 2327 bf482d49aeaf
parent 2255 42ec9dc9e1e4
permissions -rw-r--r--
#QUALITY by exept class: RegressionTests::StringTests added: #test82c_expanding

"{ Package: 'stx:goodies/regression' }"

"{ NameSpace: RegressionTests }"

TestCase subclass:#ServerSocketTest
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'tests-Regression-Streams'
!

!ServerSocketTest class methodsFor:'documentation'!

documentation
"
    documentation to be added.

    [author:]
	james (james@CHANTI)

    [instance variables:]

    [class variables:]

    [see also:]

"
!

history
    "Created: / 21-09-2004 / 14:28:22 / james"
! !

!ServerSocketTest methodsFor:'tests'!

testServerSocket
    "Tests if we can open a server socket"

    |serverListenSocket serverSocket clientSocket|

    serverListenSocket := Socket newTCPserverAtPort:9998.
    self assert:serverListenSocket notNil.
    serverListenSocket listenFor:1.

    clientSocket := Socket newTCPclientToHost:'localhost' port:9998.
    self assert:clientSocket notNil.
    clientSocket buffered:false.
    Transcript showCR:'client: socket connected it'.
    'can now do transfer via sock'.
    Transcript showCR:'sending <hello>'.
    clientSocket nextPutLine:'hello'.

    serverSocket := serverListenSocket accept.
    self assert:serverSocket notNil.
    self assert:(serverSocket nextLine = 'hello').

    clientSocket close.
    serverSocket close.
    serverListenSocket close.



    "
     self run:#test1
     self new test1
    "
! !

!ServerSocketTest class methodsFor:'documentation'!

version
    ^ '$Header$'
! !