Пример #1
0
func (s *DBusSuite) TestCallWithError(c *C) {
	rpc := NewRPC("/tmp/non-exists.sock")
	rpc.SetTimeout(1 * time.Microsecond)
	err := rpc.Connect()

	c.Assert(err, NotNil)
}
Пример #2
0
func (s *DBusSuite) TestCall(c *C) {
	socket := fmt.Sprintf("/tmp/test.%s.sock", uuid.New()[0:8])

	go Serve(socket)
	rpc := NewRPC(socket)
	rpc.SetTimeout(1 * time.Second)
	rpc.Connect()

	var result int
	rpc.Call("Arith.Add", 1, &result)

	c.Assert(result, Equals, 16)
}