ping_test.go 495 B

123456789101112131415161718192021
  1. package mcping
  2. import (
  3. "testing"
  4. "fmt"
  5. )
  6. const TestAddress = "us.mineplex.com:25565"
  7. func TestPing(t *testing.T) {
  8. response, err := Ping(TestAddress)
  9. if err != nil {
  10. t.Error(err)
  11. } else {
  12. fmt.Printf("Latency, %v\n", response.Latency)
  13. fmt.Printf("Online/Max, %v/%v\n", response.Online, response.Max)
  14. fmt.Printf("Protocol, %v, Server %v\n", response.Protocol, response.Server)
  15. fmt.Printf("Motd, %v\n", response.Motd)
  16. fmt.Printf("Favicon len, %v\n", len(response.Favicon))
  17. }
  18. }