testutil

package
v2.0.5+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2020 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Overview

Package testutil contains operations useful for testing. In particular, it provides fake connections useful for testing client/server interactions.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClosing = errors.New("use of closed network connection")
)

Functions

func NewFakeConn

func NewFakeConn(c *C) (client *FakeConn, server *FakeConn)

NewFakeConn returns a pair of fake connections suitable for testing.

Types

type FakeAddr

type FakeAddr struct {
	Value string
}

func (*FakeAddr) Network

func (addr *FakeAddr) Network() string

func (*FakeAddr) String

func (addr *FakeAddr) String() string

type FakeConn

type FakeConn struct {
	C *C
	// contains filtered or unexported fields
}

FakeConn is a fake connection used for testing. It implements the net.Conn interface and is useful for simulating I/O between STOMP clients and a STOMP server.

func (*FakeConn) Close

func (fc *FakeConn) Close() error

func (*FakeConn) LocalAddr

func (fc *FakeConn) LocalAddr() net.Addr

func (*FakeConn) Read

func (fc *FakeConn) Read(p []byte) (n int, err error)

func (*FakeConn) RemoteAddr

func (fc *FakeConn) RemoteAddr() net.Addr

func (*FakeConn) SetDeadline

func (fc *FakeConn) SetDeadline(t time.Time) error

func (*FakeConn) SetLocalAddr

func (fc *FakeConn) SetLocalAddr(addr net.Addr)

func (*FakeConn) SetReadDeadline

func (fc *FakeConn) SetReadDeadline(t time.Time) error

func (*FakeConn) SetRemoteAddr

func (fc *FakeConn) SetRemoteAddr(addr net.Addr)

func (*FakeConn) SetWriteDeadline

func (fc *FakeConn) SetWriteDeadline(t time.Time) error

func (*FakeConn) Write

func (fc *FakeConn) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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