mock

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package mock simulate a net.Conn with io.ReadWriter

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(rw io.ReadWriter) net.Conn

New new with io.ReadWriter

Types

type Mock

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

Mock a simulate a net.Conn with io.ReadWriter

func (*Mock) Close

func (m *Mock) Close() error

Close closes the connection.

func (*Mock) LocalAddr

func (m *Mock) LocalAddr() net.Addr

LocalAddr returns the local network address.

func (*Mock) Read

func (m *Mock) Read(b []byte) (n int, err error)

Read reads up to len(p) bytes into p.

func (*Mock) RemoteAddr

func (m *Mock) RemoteAddr() net.Addr

RemoteAddr returns the remote network address.

func (*Mock) SetDeadline

func (m *Mock) SetDeadline(time.Time) error

SetDeadline sets the read and write deadlines associated with the connection. It is equivalent to calling both SetReadDeadline and SetWriteDeadline.

func (*Mock) SetReadDeadline

func (m *Mock) SetReadDeadline(time.Time) error

SetReadDeadline sets the deadline for future Read calls and any currently-blocked Read call. A zero value for t means Read will not time out.

func (*Mock) SetWriteDeadline

func (m *Mock) SetWriteDeadline(time.Time) error

SetWriteDeadline sets the deadline for future Write calls and any currently-blocked Write call. Even if write times out, it may return n > 0, indicating that some of the data was successfully written. A zero value for t means Write will not time out.

func (*Mock) Write

func (m *Mock) Write(b []byte) (n int, err error)

Write writes len(p) bytes from p to the underlying data stream.

Jump to

Keyboard shortcuts

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