示例#1
0
文件: client.go 项目: nbusy/nbusy
// NewClient creates a new Client object.
func NewClient() (*Client, error) {
	c, err := neptulon.NewConn()
	if err != nil {
		return nil, err
	}

	return &Client{
		ID:      c.ID,
		Session: c.Session,
		conn:    c,
	}, nil
}
示例#2
0
// NewConnHelper creates a new client helper object.
func NewConnHelper(t *testing.T, addr string) *ConnHelper {
	if testing.Short() {
		t.Skip("Skipping integration test in short testing mode.")
	}

	conn, err := neptulon.NewConn()
	if err != nil {
		t.Fatal("Failed to create connection:", err)
	}

	conn.SetDeadline(10)
	return &ConnHelper{Conn: conn, testing: t, serverAddr: addr}
}
示例#3
0
文件: client.go 项目: soygul/titan
// NewClient creates a new Client object.
func NewClient() (*Client, error) {
	c, err := neptulon.NewConn()
	if err != nil {
		return nil, err
	}

	r := middleware.NewRouter()
	c.Middleware(r)

	return &Client{
		ID:      c.ID,
		Session: c.Session,
		conn:    c,
		router:  r,
	}, nil
}