func initServer() { server.GhostRun(&server.Options{ Addr: fmt.Sprintf("%s:%d", host, port), LogfileName: logfile, Socket: socket, }) }
func init() { go server.GhostRun(&server.Options{Addr: "localhost:6869"}) // Wait until server start // Yep, ugly. Tell if you know better solution time.Sleep(1 * time.Second) c = client.New(&client.Options{Addr: "localhost:6869"}) }
func TestSuccessfullConnect(t *testing.T) { go server.GhostRun(&server.Options{Addr: "localhost:6870"}) time.Sleep(1 * time.Second) c, err := ObtainClient("localhost", 6870) if err != nil { t.Error("Can't connect to test localhost ", err.Error()) } _, err = c.Ping() if err != nil { t.Error("Error on ping ", err.Error()) } }
func TestSuccessfullSocketConnect(t *testing.T) { go server.GhostRun(&server.Options{Addr: "localhost:6871", Socket: "123"}) time.Sleep(1 * time.Second) c, err := ObtainUnixSocketClient("123") if err != nil { t.Error("Can't connect to test localhost ", err.Error()) } _, err = c.Ping() if err != nil { t.Error("Error on ping ", err.Error()) } os.Remove("123") }
func main() { flag.Parse() server.GhostRun(&server.Options{Addr: fmt.Sprintf("%s:%d", host, port)}) }
func init() { go server.GhostRun(&server.Options{Addr: "localhost:6868"}) time.Sleep(1 * time.Second) c, _ = ObtainClient("localhost", 6868) }