nettest

package
v0.0.0-...-2824937 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2020 License: MIT, BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package nettest provides utilities for network testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestConn

func TestConn(t *testing.T, mp MakePipe)

TestConn tests that a net.Conn implementation properly satisfies the interface. The tests should not produce any false positives, but may experience false negatives. Thus, some issues may only be detected when the test is run multiple times. For maximal effectiveness, run the tests under the race detector.

Types

type MakePipe

type MakePipe func() (c1, c2 net.Conn, stop func(), err error)

MakePipe creates a connection between two endpoints and returns the pair as c1 and c2, such that anything written to c1 is read by c2 and vice-versa. The stop function closes all resources, including c1, c2, and the underlying net.Listener (if there is one), and should not be nil.

Jump to

Keyboard shortcuts

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