title: Simulate a tcp connection in Go
body: <p>In Go, a TCP connection (net.Conn) is a io.ReadWriteCloser. I'd like to test my network code by simulating a TCP connection. There are two requirements that I have:</p>
  
  <ol>
  <li>the data to be read is stored in a string</li>
  <li>whenever data is written, I'd like it to be stored in some kind of buffer which I can access later</li>
  </ol>
  
  <p>Is there a data structure for this, or an easy way to make one? </p>