testutil

package
v0.0.0-...-e5cbec8 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPort

func GetPort() int

GetPort returns a free open port that is ready to use

func NewTestingServer

func NewTestingServer(port int, status int, body string) (*http.Server, func())

NewTestingServer - testing server and teardown func

Types

type StoppableListener

type StoppableListener struct {
	net.Listener
	Stop      chan bool // Any message to this channel will gracefully stop the server
	Stopped   bool      // True if the server was stopped gracefully
	ConnCount counter   // Number of active client connections
}

StoppableListener - stoppable listener for testing purposes

func Handle

func Handle(l net.Listener) (sl *StoppableListener)

Handle - stoppable listener

func (*StoppableListener) Accept

func (sl *StoppableListener) Accept() (c net.Conn, err error)

Jump to

Keyboard shortcuts

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