@@ -95,7 +95,11 @@ func TestIntegration_ReconnectClient(t *testing.T) {
9595
9696func newFilterBase (cbMsg func ([]byte ) bool ) func ([]byte ) bool {
9797 var readBuf []byte
98+ var mu sync.Mutex
9899 return func (b []byte ) (ret bool ) {
100+ mu .Lock ()
101+ defer mu .Unlock ()
102+
99103 readBuf = append (readBuf , b ... )
100104 ret = false
101105 for {
@@ -266,8 +270,12 @@ func TestIntegration_ReconnectClient_SessionPersistence(t *testing.T) {
266270 }
267271 atomic .AddInt32 (& dialCnt , 1 )
268272 ca , cb := filteredpipe .DetectAndClosePipe (
269- newFilterBase (func ([]byte ) bool { return false }),
270273 newFilterBase (func (msg []byte ) bool {
274+ println (fmt .Sprintf ("msg<- %x" , msg ))
275+ return false
276+ }),
277+ newFilterBase (func (msg []byte ) bool {
278+ println (fmt .Sprintf ("msg-> %x" , msg ))
271279 if msg [0 ]& 0xF0 == 0x80 {
272280 atomic .AddInt32 (& subCnt , 1 )
273281 }
@@ -290,6 +298,7 @@ func TestIntegration_ReconnectClient_SessionPersistence(t *testing.T) {
290298
291299 chReceived := make (chan * Message , 100 )
292300 cli .Handle (HandlerFunc (func (msg * Message ) {
301+ t .Logf ("message: %v" , msg )
293302 chReceived <- msg
294303 }))
295304 _ , err = cli .Connect (
@@ -325,7 +334,8 @@ func TestIntegration_ReconnectClient_SessionPersistence(t *testing.T) {
325334 }
326335 }
327336 select {
328- case <- chReceived :
337+ case msg := <- chReceived :
338+ t .Logf ("received: %v" , msg )
329339 case <- ctx .Done ():
330340 t .Fatal ("Timeout" )
331341 }
@@ -350,7 +360,8 @@ func TestIntegration_ReconnectClient_SessionPersistence(t *testing.T) {
350360 t .Fatalf ("Unexpected error: '%v'" , err )
351361 }
352362 select {
353- case <- chReceived :
363+ case msg := <- chReceived :
364+ t .Logf ("received: %v" , msg )
354365 case <- ctx .Done ():
355366 t .Fatal ("Timeout" )
356367 }
0 commit comments