Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MinimalNetAdapter ¶
type MinimalNetAdapter struct {
// contains filtered or unexported fields
}
MinimalNetAdapter allows tests and other tools to use a simple network adapter without implementing all the required supporting structures.
func NewMinimalNetAdapter ¶
func NewMinimalNetAdapter(cfg *config.Config) (*MinimalNetAdapter, error)
NewMinimalNetAdapter creates a new instance of a MinimalNetAdapter
func (*MinimalNetAdapter) Connect ¶
func (mna *MinimalNetAdapter) Connect(address string) (*Routes, error)
Connect opens a connection to the given address, handles handshake, and returns the routes for this connection To simplify usage the return type contains only two routes: OutgoingRoute - for all outgoing messages IncomingRoute - for all incoming messages (excluding handshake messages)
type Routes ¶
type Routes struct {
IncomingRoute, OutgoingRoute *router.Route
// contains filtered or unexported fields
}
Routes holds the incoming and outgoing routes of a connection created by MinimalNetAdapter
func (*Routes) Disconnect ¶
func (r *Routes) Disconnect()
Disconnect closes the connection behind the routes, thus closing all routes
func (*Routes) WaitForDisconnect ¶
WaitForDisconnect waits for a disconnect up to `timeout`, skipping all messages received while waiting
func (*Routes) WaitForMessageOfType ¶
func (r *Routes) WaitForMessageOfType(command appmessage.MessageCommand, timeout time.Duration) (appmessage.Message, error)
WaitForMessageOfType waits for a message of requested type up to `timeout`, skipping all messages of any other type received while waiting