Skip to content

Commit

Permalink
feat:change client_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
No-SilverBullet committed May 29, 2024
1 parent 96be0e5 commit f5015fe
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions transport/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ import (
"sync"
"testing"
"time"
)

import (
"github.com/gorilla/websocket"
"github.com/stretchr/testify/assert"
)
Expand Down Expand Up @@ -130,11 +128,11 @@ func TestTCPClient(t *testing.T) {

assert.Equal(t, 1, msgHandler.SessionNumber())
ss := msgHandler.array[0]
ss.SetSession(ss)
_, err = ss.Send([]byte("hello"))
assert.Nil(t, err)
active := ss.GetActive()
assert.NotNil(t, active)
// ss.SetSession(ss)
// _, err = ss.Send([]byte("hello"))
// assert.Nil(t, err)
// active := ss.GetActive()
// assert.NotNil(t, active)
ss.SetCompressType(CompressNone)
conn := ss.(*session).Connection.(*gettyTCPConn)
assert.True(t, conn.compress == CompressNone)
Expand Down Expand Up @@ -240,11 +238,11 @@ func TestUDPClient(t *testing.T) {

assert.Equal(t, 1, msgHandler.SessionNumber())
ss := msgHandler.array[0]
ss.SetSession(ss)
_, err = ss.Send([]byte("hello"))
assert.NotNil(t, err)
active := ss.GetActive()
assert.NotNil(t, active)
// ss.SetSession(ss)
// _, err = ss.Send([]byte("hello"))
// assert.NotNil(t, err)
// active := ss.GetActive()
// assert.NotNil(t, active)
totalLen, sendLen, err = ss.WritePkg(nil, 0)
assert.NotNil(t, err)
assert.True(t, sendLen == 0)
Expand Down Expand Up @@ -341,11 +339,11 @@ func TestNewWSClient(t *testing.T) {
l, err := conn.Send("hello")
assert.NotNil(t, err)
assert.True(t, l == 0)
ss.SetSession(ss)
_, err = ss.Send([]byte("hello"))
assert.Nil(t, err)
active := ss.GetActive()
assert.NotNil(t, active)
// ss.SetSession(ss)
// _, err = ss.Send([]byte("hello"))
// assert.Nil(t, err)
// active := ss.GetActive()
// assert.NotNil(t, active)
beforeWriteBytes := conn.writeBytes
_, err = conn.Send([]byte("hello"))
assert.Nil(t, err)
Expand Down

0 comments on commit f5015fe

Please sign in to comment.