xmpptest

package
v0.17.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2020 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package xmpptest provides utilities for XMPP testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSession

func NewSession(state xmpp.SessionState, rw io.ReadWriter) *xmpp.Session

NewSession returns a new client-to-client XMPP session with the state bits set to state|xmpp.Ready, the origin JID set to "test@example.net" and the location JID set to "example.net".

NewSession panics on error for ease of use in testing, where a panic is acceptable.

func NopNegotiator added in v0.7.1

func NopNegotiator(state xmpp.SessionState) xmpp.Negotiator

NopNegotiator marks the state as ready (by returning state|xmpp.Ready) and pops the first token (likely <stream:stream>) but does not perform any validation on the token, transmit any data over the wire, or perform any other session negotiation.

Types

type ClientServer added in v0.17.1

type ClientServer struct {
	Client *xmpp.Session
	Server *xmpp.Session
	// contains filtered or unexported fields
}

ClientServer is two coupled xmpp.Session's that can respond to one another in tests.

func NewClientServer added in v0.17.1

func NewClientServer(opts ...Option) *ClientServer

NewClientServer returns a ClientServer with the client and server goroutines started. Both serve goroutines are started when NewClient is called and shut down when Client is closed.

func (*ClientServer) Close added in v0.17.1

func (cs *ClientServer) Close() error

Close calls the client and server sessions' close methods.

type Option added in v0.17.1

type Option func(*ClientServer)

Option is a type for configuring a ClientServer.

func ClientHandler added in v0.17.1

func ClientHandler(handler xmpp.Handler) Option

ClientHandler sets up the client side of a ClientServer.

func ClientHandlerFunc added in v0.17.1

func ClientHandlerFunc(handler xmpp.HandlerFunc) Option

ClientHandlerFunc sets up the client side of a ClientServer using an xmpp.HandlerFunc.

func ClientState added in v0.17.1

func ClientState(state xmpp.SessionState) Option

ClientState configures extra state bits to add to the client session.

func ServerHandler added in v0.17.1

func ServerHandler(handler xmpp.Handler) Option

ServerHandler sets up the server side of a ClientServer.

func ServerHandlerFunc added in v0.17.1

func ServerHandlerFunc(handler xmpp.HandlerFunc) Option

ServerHandlerFunc sets up the server side of a ClientServer using an xmpp.HandlerFunc.

func ServerState added in v0.17.1

func ServerState(state xmpp.SessionState) Option

ServerState configures extra state bits to add to the server session.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL