Skip to content

Commit

Permalink
rm test
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxx2026 committed Mar 28, 2020
1 parent c3c9cb3 commit 3be63a9
Showing 1 changed file with 0 additions and 54 deletions.
54 changes: 0 additions & 54 deletions test/qrpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,60 +27,6 @@ const (
n = 100000
)

// TestConnection tests connection
func TestMwStash(t *testing.T) {

go startServerMw()
time.Sleep(time.Millisecond * 500)

conf := qrpc.ConnectionConfig{}

conn, err := qrpc.NewConnection(addr, conf, func(conn *qrpc.Connection, frame *qrpc.Frame) {
fmt.Println(frame)
})
if err != nil {
panic(err)
}

_, resp, err := conn.Request(HelloCmd, 0, []byte(" xu"))
if err != nil {
panic(err)
}
frame, err := resp.GetFrame()
if err != nil {
panic(err)
}

fmt.Println("resp is ", string(frame.Payload))
}


func Mw(_ qrpc.FrameWriter, request *qrpc.RequestFrame) bool {
request.SetStash("mw stash")
return true
}

func startServerMw() {
handler := qrpc.NewServeMux()
handler.HandleFunc(HelloCmd, func(writer qrpc.FrameWriter, request *qrpc.RequestFrame) {
// time.Sleep(time.Hour)
writer.StartWrite(request.RequestID, HelloRespCmd, 0)
stash := request.GetStash()
writer.WriteBytes(append([]byte("hello " + stash.(string)), request.Payload...))
err := writer.EndWrite()
if err != nil {
panic(err)
}
}, Mw)
bindings := []qrpc.ServerBinding{
qrpc.ServerBinding{Addr: addr, Handler: handler, ReadFrameChSize: 10000, WriteFrameChSize: 1000, WBufSize: 2000000, RBufSize: 2000000}}
server := qrpc.NewServer(bindings)
err := server.ListenAndServe()
if err != nil {
panic(err)
}
}

// TestConnection tests connection
func TestNonStream(t *testing.T) {

Expand Down

0 comments on commit 3be63a9

Please sign in to comment.