RegressionTests__WebSocketTest.st
changeset 2562 0f920774542b
parent 2561 4fd04d5d12d9
child 2563 9e9b8eacd782
--- a/RegressionTests__WebSocketTest.st	Fri Feb 07 13:51:18 2020 +0100
+++ b/RegressionTests__WebSocketTest.st	Fri Feb 07 16:07:52 2020 +0100
@@ -76,19 +76,6 @@
     "Created: / 05-02-2020 / 13:24:53 / Stefan Reise"
 ! !
 
-!WebSocketTest class methodsFor:'actions'!
-
-resetServerAndClientWebsocket
-    "
-        self resetServerAndClientWebsocket
-    "
-
-    ServerWebSocket := nil.
-    ClientWebSocket := nil.
-
-    "Created: / 17-01-2020 / 13:37:18 / Stefan Reise"
-! !
-
 !WebSocketTest methodsFor:'data'!
 
 allData
@@ -474,9 +461,6 @@
 
 testCommunication
     "
-        !! call the following method in case the sockets did get corrupted !!
-        self resetServerAndClientWebsocket              
-
         WebSocketStream verbose:true.
         WebSocketStream verboseProtocol:true.
 
@@ -498,9 +482,6 @@
 
 testCommunication100
     "
-        !! call the following method in case the sockets did get corrupted !!
-        self resetServerAndClientWebsocket              
-
         WebSocketStream verbose:true.
         WebSocketStream verboseProtocol:true.
 
@@ -521,9 +502,6 @@
 
 testCommunication100Speed
     "
-        !! call the following method in case the sockets did get corrupted !!
-        self resetServerAndClientWebsocket              
-
         WebSocketStream verbose:true.
         WebSocketStream verboseProtocol:true.
 
@@ -565,15 +543,17 @@
         finishSema signal.
     ] forkAt:4.
 
-    Delay waitForSeconds:1.
-    pingDuration := self clientWebSocket ping. 
-    Transcript showCR:'ping duration: ', pingDuration printString.
-    self assert:pingDuration < 15 seconds.
+    5 timesRepeat:[
+        Delay waitForSeconds:1.
+        pingDuration := self clientWebSocket ping. 
+        Transcript showCR:'ping duration: ', pingDuration printString.
+        self assert:pingDuration < 5 seconds.
 
-    Delay waitForSeconds:1.
-    pingDuration := self serverWebSocket ping. 
-    Transcript showCR:'ping duration: ', pingDuration printString.
-    self assert:pingDuration < 15 seconds.
+        Delay waitForSeconds:1.
+        pingDuration := self serverWebSocket ping. 
+        Transcript showCR:'ping duration: ', pingDuration printString.
+        self assert:pingDuration < 5 seconds.
+    ].
 
     finishSema wait.
 
@@ -583,9 +563,6 @@
 
 testCommunicationByteArray100
     "
-        !! call the following method in case the sockets did get corrupted !!
-        self resetServerAndClientWebsocket              
-
         WebSocketStream verbose:true.
         WebSocketStream verboseProtocol:true.
 
@@ -606,9 +583,6 @@
 
 testCommunicationFilename
     "
-        !! call the following method in case the sockets did get corrupted !!
-        self resetServerAndClientWebsocket              
-
         WebSocketStream verbose:true.
         WebSocketStream verboseProtocol:true.
 
@@ -634,9 +608,6 @@
 
 testCommunicationSmallFrameSize
     "
-        !! call the following method in case the sockets did get corrupted !!
-        self resetServerAndClientWebsocket              
-
         WebSocketStream verbose:true.
         WebSocketStream verboseProtocol:true.
 
@@ -664,9 +635,6 @@
 
 testCommunicationSmallFrameSizeData5
     "
-        !! call the following method in case the sockets did get corrupted !!
-        self resetServerAndClientWebsocket              
-
         WebSocketStream verbose:true.
         WebSocketStream verboseProtocol:true.
 
@@ -674,9 +642,7 @@
         WebSocketStream verboseProtocol:false.
 
         WebSocketStream maxBytesPerFrame:1024. 
-        WebSocketStream maxBytesPerFrame:nil.    
-
-        self new allData first
+        WebSocketStream maxBytesPerFrame:nil.      
     "
 
     |maxSizeInByterPerFrameBefore|
@@ -695,9 +661,6 @@
 
 testCommunicationWithDelay
     "
-        !! call the following method in case the sockets did get corrupted !!
-        self resetServerAndClientWebsocket              
-
         WebSocketStream verbose:true.
         WebSocketStream verboseProtocol:true.
 
@@ -731,14 +694,14 @@
 
 testEncoding
     "
-        !! call the following method in case the sockets did get corrupted !!
-        self resetServerAndClientWebsocket           
-
         WebSocketStream verbose:true.
         WebSocketStream verboseProtocol:true.
 
         WebSocketStream verbose:false.
-        WebSocketStream verboseProtocol:false.   
+        WebSocketStream verboseProtocol:false.
+
+        WebSocketStream maxBytesPerFrame:1024. 
+        WebSocketStream maxBytesPerFrame:nil.      
     "
 
     |serverWebSocket clientWebSocket 
@@ -823,16 +786,13 @@
 
 testParallelSocketWrite
     "
-        !! call the following method in case the sockets did get corrupted !!
-        self resetServerAndClientWebsocket           
-
         WebSocketStream verbose:true.
         WebSocketStream verboseProtocol:true.
 
         WebSocketStream verbose:false.
-        WebSocketStream verboseProtocol:false.   
+        WebSocketStream verboseProtocol:false.
 
-        WebSocketStream maxBytesPerFrame:8178. 
+        WebSocketStream maxBytesPerFrame:1024. 
         WebSocketStream maxBytesPerFrame:nil.      
     "
 
@@ -854,14 +814,14 @@
 
 testPing
     "
-        !! call the following method in case the sockets did get corrupted !!
-        self resetServerAndClientWebsocket           
-
         WebSocketStream verbose:true.
         WebSocketStream verboseProtocol:true.
 
-        WebSocketStream verbose:false.             
-        WebSocketStream verboseProtocol:false.   
+        WebSocketStream verbose:false.
+        WebSocketStream verboseProtocol:false.
+
+        WebSocketStream maxBytesPerFrame:1024. 
+        WebSocketStream maxBytesPerFrame:nil.      
     "
 
     |pingTimeDuration|