Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToResult ¶
func ToResult(result interface{}) json.RawMessage
ToResult JSON-marshals the resul. Panics on error.
Types ¶
type Server ¶
type Server struct { OnRequest AtomicVal[func(conn net.Conn, request *types.Request) *types.Response] Port int // contains filtered or unexported fields }
Server is a TCP server useful for mocking a JSON RPC server.
func NewServerUsingPort ¶
NewServerUsingPort creates a mock server on the given port.
func (*Server) Close ¶
func (s *Server) Close()
Close closes the server. It blocks until all client connections are closed.
func (*Server) SetOnNewClient ¶
SetOnNewClient defines a callback that is called when a new client connects to this server.
Click to show internal directories.
Click to hide internal directories.