#FEATURE by Stefan Reise
authorsr
Tue, 21 Jan 2020 11:41:23 +0100
changeset 2516 c3e64a6f07ac
parent 2515 f90381bad385
child 2517 f1c701aada27
#FEATURE by Stefan Reise class: RegressionTests::WebSocketTest removed: #testCommunication12 class: RegressionTests::WebSocketTest::DemoWebSocketService class class: WebSocketTest added: #testCommunication12 #testCommunicationWithDelay comment/format in: #allData #allDataWithFrameHash #testCommunication class: WebSocketTest::DemoWebSocketService class comment/format in: #defaultPort
RegressionTests__WebSocketTest.st
--- a/RegressionTests__WebSocketTest.st	Mon Jan 20 18:12:36 2020 +0100
+++ b/RegressionTests__WebSocketTest.st	Tue Jan 21 11:41:23 2020 +0100
@@ -70,6 +70,10 @@
 !WebSocketTest methodsFor:'data'!
 
 allData
+    "
+        self new allData
+    "    
+
     |allData|
 
     allData := OrderedCollection new.
@@ -80,9 +84,14 @@
     ^ allData
 
     "Created: / 20-01-2020 / 13:56:05 / Stefan Reise"
+    "Modified (comment): / 21-01-2020 / 10:38:54 / Stefan Reise"
 !
 
 allDataWithFrameHash
+    "
+        self new allDataWithFrameHash
+    "    
+
     ^ self dataWithLength0AndFrameHash                      "/ zero data
     , self dataWithLength11AndFrameHash                     "/ just hello world
     , self dataWithLength125AndFrameHash                    "/ last fitting length for the single byte
@@ -96,6 +105,7 @@
     , self dataWithLengthMaxTestAndFrameHash                "/ max length for testing
 
     "Created: / 20-01-2020 / 13:54:14 / Stefan Reise"
+    "Modified (comment): / 21-01-2020 / 10:38:30 / Stefan Reise"
 !
 
 dataWithLength0AndFrameHash
@@ -324,8 +334,42 @@
     ].
 
     "Created: / 17-01-2020 / 13:24:24 / Stefan Reise"
-    "Modified: / 20-01-2020 / 15:21:56 / Stefan Reise"
-    "Modified (comment): / 20-01-2020 / 18:09:02 / Stefan Reise"
+    "Modified: / 21-01-2020 / 11:25:32 / Stefan Reise"
+!
+
+testCommunicationWithDelay
+    "
+        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 maxSizeInByterPerFrame:1024. 
+        WebSocketStream maxSizeInByterPerFrame:nil.      
+    "
+
+    self allData do:[:data |
+        self clientWebSocket nextPut:data.
+    ].
+
+    Delay waitForSeconds:2.
+
+    self allData do:[:data |
+        self assert:self serverWebSocket next = data.
+        self serverWebSocket nextPut:data.
+    ].
+
+    Delay waitForSeconds:2.  
+
+    self allData do:[:data |
+        self assert:self clientWebSocket next = data.
+    ].
+
+    "Created: / 21-01-2020 / 11:26:23 / Stefan Reise"
 !
 
 testEncoding