package sproto_Protocol import ( "fmt" cherryHttp "github.com/cherry-game/cherry/extend/http" sproto "github.com/xjdrew/gosproto" "testing" ) func TestSProto(t *testing.T) { languageID := int64(1) systemMsg := &SystemMsg{ LanguageId: &languageID, Args: []string{"aaa", "bbb", "ccc"}, } bytes, err := sproto.Encode(systemMsg) fmt.Println(err) fmt.Println(bytes) systemMsg1 := &SystemMsg{} sproto.Decode(bytes, systemMsg1) fmt.Println(systemMsg1) } func TestROK(t *testing.T) { url := "http://192.168.200.129:58005/recharge" str := &struct { RID int64 `json:"rid"` SN int64 `json:"sn"` IGGID string `json:"iggid"` PCID int64 `json:"pc_id"` index int64 `json:"index"` }{ RID: 10000003, SN: 1, IGGID: "ID1976875", PCID: 24613, //24599, // index: 1, } for i := 0; i < 1000; i++ { bytes, rsp, err := cherryHttp.PostJSON(url, str) fmt.Println(string(bytes), rsp.StatusCode, err) } }