github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/talks/2014/go4java/loopback.go (about) 1 // +build OMIT 2 3 package main 4 5 import ( 6 "bytes" 7 "net" 8 ) 9 10 func handleConn(conn net.Conn) { 11 // does something that should be tested. 12 } 13 14 type loopBack struct { 15 net.Conn 16 buf bytes.Buffer 17 } 18 19 func (c *loopBack) Read(b []byte) (int, error) { 20 return c.buf.Read(b) 21 } 22 23 func (c *loopBack) Write(b []byte) (int, error) { 24 return c.buf.Write(b) 25 }