package testUnit import ( "goUpload/dbHelper" "strconv" "testing" "time" ) func TestUDP_push(t *testing.T) { udp := dbHelper.UdpHelper{ Host: "10.8.30.110", Port: 8888, } udp.Initial() udp.Publish([]byte("123456")) var bytes []byte for i := 0; i < 5; i++ { bytes = append(bytes, strconv.Itoa(i)...) udp.Publish(bytes) time.Sleep(time.Second) } udp.Close() }