Listener implements a net.Listener that creates local, buffered net.Conns via its Accept and Dial method.
type Listener struct {
// contains filtered or unexported fields
}
func Listen(sz int) *Listener
Listen returns a Listener that can only be contacted by its own Dialers and creates buffered connections between the two.
func (l *Listener) Accept() (net.Conn, error)
Accept blocks until Dial is called, then returns a net.Conn for the server half of the connection.
func (l *Listener) Addr() net.Addr
Addr reports the address of the listener.
func (l *Listener) Close() error
Close stops the listener.
func (l *Listener) Dial() (net.Conn, error)
Dial creates an in-memory full-duplex network connection, unblocks Accept by providing it the server half of the connection, and returns the client half of the connection.
func (l *Listener) DialContext(ctx context.Context) (net.Conn, error)
DialContext creates an in-memory full-duplex network connection, unblocks Accept by providing it the server half of the connection, and returns the client half of the connection. If ctx is Done, returns ctx.Err()