Beispiel #1
0
// 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
}
Beispiel #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}
}
Beispiel #3
0
// 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
}