func TestBadTCPClientConnect(t *testing.T) {
	client, err := clients.New("321321321", "")
	if err == nil {
		t.Fatalf("Client succeeded to connect")
	}
	client, err = clients.New(testAddr, "hil")
	if err != nil {
		t.Fatalf("Client failed to connect - %s", err.Error())
		t.FailNow()
	}
	defer client.Close()
	if err := client.Ping(); err != nil {
		t.Fatalf("ping failed")
	}
	if msg := <-client.Messages(); msg.Data != "pong" {
		t.Fatalf("Unexpected data: Expecting 'pong' got %s", msg.Data)
	}
	client.Ping()
}
TestBadTCPClientConnect tests to ensure a client can connect to a running server
package clients_test
import (
	"os"
	"testing"
	"time"
	"github.com/jcelliott/lumber"
	"github.com/nanopack/mist/clients"
	"github.com/nanopack/mist/server"
)
var (
	testAddr = "127.0.0.1:2445"
	testTag  = "hello"
	testMsg  = "world"
)
func TestMain(m *testing.M) {
	lumber.Level(lumber.LvlInt("fatal"))
	server.StartTCP(testAddr, nil)
	os.Exit(m.Run())
}
func TestTCPClientConnect(t *testing.T) {
	client, err := clients.New(testAddr, "")
	if err != nil {
		t.Fatalf("Client failed to connect - %s", err.Error())
		t.FailNow()
	}
	defer client.Close()
	if err := client.Ping(); err != nil {
		t.Fatalf("ping failed")
	}
	if msg := <-client.Messages(); msg.Data != "pong" {
		t.Fatalf("Unexpected data: Expecting 'pong' got %s", msg.Data)
	}
	client.Ping()
}