Version: v2.5.1+incompatible Latest Latest

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

Go to latest
Published: Oct 4, 2019 License: Apache-2.0 Imports: 4 Imported by: 0




This section is empty.


This section is empty.


func FreeTCPPort

func FreeTCPPort() uint16

FreeTCPPort returns a TCP port that is free on "localhost", or panics if it cannot find a port

func TCPPort

func TCPPort(l NetworkListener) uint16

TCPPort of the listener address. If the listener isn't TCP, this may panic()


type NetworkListener

type NetworkListener interface {
	Addr() net.Addr

A NetworkListener is a listener that looks for data on a network address. It is sometimes useful in testing to get this address so you can talk to it directly.

type TrackingDialer

type TrackingDialer struct {
	Dialer net.Dialer
	Conns  []net.Conn

TrackingDialer remembers connections it's made and allows users to close them

func (*TrackingDialer) Close

func (t *TrackingDialer) Close() error

Close all stored connections. Returns an error on the first close that fails

func (*TrackingDialer) DialTimeout

func (t *TrackingDialer) DialTimeout(network, address string, timeout time.Duration) (net.Conn, error)

DialTimeout simulates net.DialTimeout

Jump to

Keyboard shortcuts

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