bitly/go-nsq — pull request #53 by mreiferson (2014-06-23 13:44:59+00:00)
Title: non-obvious nsq.Conn requiring nsq.ConnDelegate

Hey,

The following causes a panic:
```go
func TestConnection(t *testing.T) {
t.Log("Testing connection...")
conn := nsq.NewConn("localhost:4150", defaultConfig)
id, err := conn.Connect()
if err != nil {
t.Fatal(err)
}
t.Log(id)
time.Sleep(100 * time.Nanosecond)
conn.Close()
time.Sleep(100 * time.Nanosecond)
t.Log("Success.")
return
}
```
![screen shot 2014-06-21 at 6 49 25 pm](https://cloud.githubusercontent.com/assets/2940902/3350200/5e9f1dd8-f996-11e3-986d-87327f7f05cd.png)

There is (I presume) a race somewhere in Close(). If you sleep for long enough (a few microseconds), the panic doesn't occur.