# Packages

Package servertest provides utilities for running tests against a remote LSP server.

# Functions

HandlerServer returns a StreamServer that handles incoming streams using the provided handler.
ListenAndServe starts an jsonrpc2 server on the given address.
NewConn creates a new connection object around the supplied stream.
NewErrorf builds a Error struct for the supplied message and code.
NewHeaderStream returns a Stream built on top of an io.Reader and io.Writer The messages are sent with HTTP content length and MIME type headers.
NewStream returns a Stream built on top of an io.Reader and io.Writer The messages are sent with no wrapping, and rely on json decode consistency to determine message boundaries.
Serve accepts incoming connections from the network, and handles them using the provided server.

# Constants

CodeInternalError is not currently returned but defined for completeness.
CodeInvalidParams should be returned by the handler when method parameter(s) were invalid.
CodeInvalidRequest is used when the JSON sent is not a valid Request object.
CodeMethodNotFound should be returned by the handler when the method does not exist / is not available.
CodeParseError is used when invalid JSON was received by the server.
CodeServerOverloaded is returned when a message was refused due to aserver being temporarily unable to accept any new messages.
CodeUnknownError should be used for all non coded errors.
Receive indicates the message is incoming.
Send indicates the message is outgoing.

# Variables

ErrDisconnected signals that the stream or connection exited normally.
ErrIdleTimeout is returned when serving timed out waiting for new connections.

# Structs

Conn is a JSON RPC 2 client server connection.
No description provided by the author
Error represents a structured error in a Response.
ID is a Request identifier.
Request is sent to a server to represent a Call or Notify operaton.
VersionTag is a special 0 sized struct that encodes as the jsonrpc version tag.
WireRequest is sent to a server to represent a Call or Notify operaton.
WireResponse is a reply to a Request.

# Interfaces

Handler is the interface used to hook into the message handling of an rpc connection.
Stream abstracts the transport mechanics from the JSON RPC protocol.
A StreamServer is used to serve incoming jsonrpc2 clients communicating over a newly created stream.

# Type aliases

Direction is used to indicate to a logger whether the logged message was being sent or received.
The ServerFunc type is an adapter that implements the StreamServer interface using an ordinary function.