示例#1
0
func main() {

	port := flag.Int("port", Port, "Define port number")
	showStats := flag.Bool("stat", true, "Show statistics report at termination")

	flag.Parse()

	hub := hub.NewHub(*port)
	ServerConnect(hub, *showStats)

}
示例#2
0
	"testing"
	"time"
)

const (
	Port = 9999
	Addr = "localhost"

	TimeoutTime       = 5 * time.Second
	ClientsNum        = 25
	PayloadBytes      = 1024 * 10
	MessagesPerCLient = 10
)

var climap = syncmap.NewSyncMap()
var server = hub.NewHub(Port)
var testBody = testutils.GenPayload(PayloadBytes)
var allCliId []uint64

func TestInit(t *testing.T) {
	go server.Run()
}

func TestIdentity(t *testing.T) {

	assert := assert.New(t)
	var wg sync.WaitGroup

	wg.Add(ClientsNum)
	for i := 0; i < ClientsNum; i++ {
		go func() {