MCPcopy
hub / github.com/aceld/zinx / TestServer

Function TestServer

znet/server_test.go:137–155  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

135}
136
137func TestServer(t *testing.T) {
138 s := NewServer()
139
140 s.SetOnConnStart(DoConnectionBegin)
141 s.SetOnConnStop(DoConnectionLost)
142
143 s.AddRouter(1, &PingRouter{})
144 s.AddRouter(2, &HelloRouter{})
145
146 go ClientTest(1)
147 go ClientTest(2)
148
149 go s.Serve()
150
151 select {
152 case <-time.After(time.Second * 10):
153 return
154 }
155}
156
157func TestServerDeadLock(t *testing.T) {
158 s := NewServer()

Callers

nothing calls this directly

Calls 6

SetOnConnStartMethod · 0.95
SetOnConnStopMethod · 0.95
AddRouterMethod · 0.95
ServeMethod · 0.95
NewServerFunction · 0.85
ClientTestFunction · 0.85

Tested by

no test coverage detected