-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatis_test.go
More file actions
65 lines (62 loc) · 1.88 KB
/
statis_test.go
File metadata and controls
65 lines (62 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright 2021 fangyousong(方友松). All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package iip
import (
"testing"
"time"
)
func TestServerCount(t *testing.T) {
client, err := NewClient(ClientConfig{
MaxConnections: 1000,
MaxChannelsPerConn: 10,
ChannelPacketQueueLen: 1000,
TcpWriteQueueLen: 1000,
TcpReadBufferSize: 16 * 1024,
TcpWriteBufferSize: 16 * 1024,
TcpConnectTimeout: time.Second * 3,
}, ":9090", nil)
if err != nil {
t.Fatalf("connect server fail")
return
}
channel, err := client.NewChannel()
if err != nil {
t.Fatalf("new channel fail, %s", err.Error())
return
}
// echoData := []byte("{}")
// bts, err := channel.DoRequest(PathServerCountJson, NewDefaultRequest(echoData), time.Second)
// if err != nil {
// t.Fatalf(err.Error())
// }
// fmt.Println(string(bts))
// bts, err = channel.DoRequest(PathServerMeasureJson, NewDefaultRequest(echoData), time.Second)
// if err != nil {
// t.Fatalf(err.Error())
// }
// fmt.Println(string(bts))
// echoData = []byte("/echo")
// bts, err = channel.DoRequest(PathServerPathCountJson, NewDefaultRequest(echoData), time.Second)
// if err != nil {
// t.Fatalf(err.Error())
// }
// fmt.Println(string(bts))
// echoData = []byte("/echo")
// bts, err = channel.DoRequest(PathServerPathMeasureJson, NewDefaultRequest(echoData), time.Second)
// if err != nil {
// t.Fatalf(err.Error())
// }
// fmt.Println(string(bts))
echoData := []byte(`{"time_unit": "microsecond"}`)
_, err = channel.DoRequest(PathServerStatis, NewDefaultRequest(echoData), time.Second)
if err != nil {
t.Fatalf(err.Error())
}
// fmt.Println(string(bts))
_, err = channel.DoRequest(PathServerConnectionStatis, NewDefaultRequest(echoData), time.Second*3)
if err != nil {
t.Fatalf(err.Error())
}
// fmt.Println(string(bts))
}