func main() { gslogger.NewFlags(gslogger.ERROR | gslogger.INFO) var eventLoop = gorpc.NewEventLoop(uint32(runtime.NumCPU()), 2048, 500*time.Millisecond) tcp.NewServer( gorpc.BuildPipeline(eventLoop), ).EvtNewPipeline(tcp.EvtNewPipeline(func(pipeline gorpc.Pipeline) { pipeline.AddService(rpctest.MakeServer(0, &_MockServer{})) })).Listen(":13512") }
package rpctest import ( "runtime" "testing" "time" "github.com/gsdocker/gslogger" "github.com/gsrpc/gorpc" "github.com/gsrpc/gorpc/tcp" ) var eventLoop = gorpc.NewEventLoop(uint32(runtime.NumCPU()), 2048, 500*time.Millisecond) var client tcp.Client var server Server var content = []byte("hello world") var content2 = []byte("hello worldhello worldhello worldhello worldhello worldhello worldhello worldhello worldhello worldhello world") func init() { gslogger.NewFlags(gslogger.ERROR | gslogger.INFO) var err error client, err = tcp.BuildClient(gorpc.BuildPipeline(eventLoop)).Connect("test") if err != nil { panic(err) }