transport

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2018 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockConn

type MockConn struct {
	// contains filtered or unexported fields
}

MockConn represents a net.Conn mocked implementation.

func NewMockConn

func NewMockConn() *MockConn

NewMockConn returns a new initialized MockConn instance.

func (*MockConn) Close

func (mc *MockConn) Close() error

Close marks mocked connection as closed.

func (*MockConn) IsClosed

func (mc *MockConn) IsClosed() bool

IsClosed returns whether or not the mocked connection has been closed.

func (*MockConn) LocalAddr

func (mc *MockConn) LocalAddr() net.Addr

LocalAddr returns a mocked remote address.

func (*MockConn) Read

func (mc *MockConn) Read(b []byte) (n int, err error)

Read performs a read operation on the mocked connection.

func (*MockConn) ReadBytes

func (mc *MockConn) ReadBytes() []byte

ReadBytes retrieves previous write operation written bytes.

func (*MockConn) ReadElements

func (mc *MockConn) ReadElements() []xml.Element

ReadElements deserializes previous write operation content into an XML elements array.

func (*MockConn) RemoteAddr

func (mc *MockConn) RemoteAddr() net.Addr

RemoteAddr returns a mocked remote address.

func (*MockConn) SendBytes

func (mc *MockConn) SendBytes(b []byte)

SendBytes sets next read operation content.

func (*MockConn) SendElement

func (mc *MockConn) SendElement(elem xml.Element)

SendElement sets next read operation content from a serialized XML element.

func (*MockConn) SetDeadline

func (mc *MockConn) SetDeadline(t time.Time) error

SetDeadline satisfies net.Conn interface.

func (*MockConn) SetReadDeadline

func (mc *MockConn) SetReadDeadline(t time.Time) error

SetReadDeadline satisfies net.Conn interface.

func (*MockConn) SetWriteDeadline

func (mc *MockConn) SetWriteDeadline(t time.Time) error

SetWriteDeadline satisfies net.Conn interface.

func (*MockConn) WaitClose

func (mc *MockConn) WaitClose()

WaitClose expects until the mocked connection closes.

func (*MockConn) WaitCloseWithTimeout

func (mc *MockConn) WaitCloseWithTimeout(timeout time.Duration)

WaitCloseWithTimeout expects until the mocked connection closes or until a timeout fires.

func (*MockConn) Write

func (mc *MockConn) Write(b []byte) (n int, err error)

Write performs a write operation on the mocked connection.

type MockTransport

type MockTransport struct {
	// contains filtered or unexported fields
}

MockTransport represents a mocked transport type.

func NewMockTransport

func NewMockTransport() *MockTransport

NewMockTransport returns a new MockTransport instance.

func (*MockTransport) ChannelBindingBytes

func (mt *MockTransport) ChannelBindingBytes(config.ChannelBindingMechanism) []byte

ChannelBindingBytes returns mocked transport channel binding bytes.

func (*MockTransport) Close

func (mt *MockTransport) Close() error

Close marks a mocked transport as closed.

func (*MockTransport) EnableCompression

func (mt *MockTransport) EnableCompression(level config.CompressionLevel)

EnableCompression marks a mocked transport as compressed.

func (*MockTransport) GetWrittenBytes

func (mt *MockTransport) GetWrittenBytes() []byte

GetWrittenBytes returns transport previously written bytes.

func (*MockTransport) IsClosed

func (mt *MockTransport) IsClosed() bool

IsClosed returns whether or not the mocked transport has been previously closed.

func (*MockTransport) IsCompressed

func (mt *MockTransport) IsCompressed() bool

IsCompressed returns whether or not the mocked transport has been previously compressed.

func (*MockTransport) IsSecured

func (mt *MockTransport) IsSecured() bool

IsSecured returns whether or not the mocked transport has been previously secured.

func (*MockTransport) Read

func (mt *MockTransport) Read(p []byte) (n int, err error)

Read reads a byte array from the mocked transport.

func (*MockTransport) SetChannelBindingBytes

func (mt *MockTransport) SetChannelBindingBytes(cBindingBytes []byte)

SetChannelBindingBytes sets mocked transport channel binding bytes.

func (*MockTransport) SetReadBytes

func (mt *MockTransport) SetReadBytes(p []byte)

SetReadBytes sets transport next read operation result.

func (*MockTransport) StartTLS

func (mt *MockTransport) StartTLS(tlsCfg *tls.Config)

StartTLS secures the mocked transport.

func (*MockTransport) Write

func (mt *MockTransport) Write(p []byte) (n int, err error)

Write writes a byte array to the mocked transport internal buffer.

type Transport

type Transport interface {
	io.ReadWriteCloser

	// StartTLS secures the transport using SSL/TLS
	StartTLS(*tls.Config)

	// EnableCompression activates a compression
	// mechanism on the transport.
	EnableCompression(config.CompressionLevel)

	// ChannelBindingBytes returns current transport
	// channel binding bytes.
	ChannelBindingBytes(config.ChannelBindingMechanism) []byte
}

Transport represents a stream transport mechanism.

func NewSocketTransport

func NewSocketTransport(conn net.Conn, bufferSize, keepAlive int) Transport

NewSocketTransport creates a socket class stream transport.

Jump to

Keyboard shortcuts

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