--- a/RegressionTests__SocketTests.st Tue Nov 29 18:15:35 2011 +0100
+++ b/RegressionTests__SocketTests.st Tue Nov 29 18:19:17 2011 +0100
@@ -49,6 +49,59 @@
Transcript showCR:'n1: %1; n2: %2' with:n1 with:n2
"Created: / 29-11-2011 / 14:43:57 / cg"
+!
+
+test11_concurrentOpenClose
+ "using a non-existing host name (hoping that the connect will take longer then,
+ and we can enforce concurrent execution)"
+
+ |p1 p2 sock port n1 n2|
+
+ port := 80.
+ n1 := n2 := 0.
+
+ p1 :=
+ [
+ |host|
+
+ [true] whileTrue:[
+ host := 'www.nonexisting-%1.de' bindWith:(UUID genRandomUUID).
+ HostNameLookupError handle:[:ex |
+ ] do:[
+ sock := Socket newTCPclientToAddress:host port:port.
+ Processor yield.
+ n1 := n1 + 1.
+ sock close
+ ].
+ ]
+ ] newProcess.
+
+ p2 :=
+ [
+ |host|
+
+ [true] whileTrue:[
+ host := 'www.nonexisting-%1.de' bindWith:(UUID genRandomUUID).
+ HostNameLookupError handle:[:ex |
+ ] do:[
+ sock := Socket newTCPclientToAddress:host port:port.
+ Processor yield.
+ n2 := n2 + 1.
+ sock close
+ ]
+ ]
+ ] newProcess.
+
+ p1 resume.
+ p2 resume.
+
+ Delay waitForSeconds:20.
+ p1 terminate.
+ p2 terminate.
+
+ Transcript showCR:'n1: %1; n2: %2' with:n1 with:n2
+
+ "Created: / 29-11-2011 / 18:17:04 / cg"
! !
!SocketTests class methodsFor:'documentation'!