DialInProc attaches an in-process connection to the given RPC server.
(handler *Server)
| 23 | |
| 24 | // DialInProc attaches an in-process connection to the given RPC server. |
| 25 | func DialInProc(handler *Server) *Client { |
| 26 | initctx := context.Background() |
| 27 | c, _ := newClient(initctx, func(context.Context) (net.Conn, error) { |
| 28 | p1, p2 := net.Pipe() |
| 29 | go handler.ServeCodec(NewJSONCodec(p1), OptionMethodInvocation|OptionSubscriptions) |
| 30 | return p2, nil |
| 31 | }) |
| 32 | return c |
| 33 | } |