// Test that after the configured expiry time, a stored connection expires and // is nulled out. func TestBasicExpiry(t *testing.T) { var table connTable table.Init() defer table.Stop() // This currently panics due to issue #13. table.Notify("bar", makeTestConn()) timing.Elapse(c_SOCKET_EXPIRY) timing.Elapse(time.Nanosecond) if table.GetConn("bar") != nil { t.FailNow() } }
// Test that if a connection is allowed to expire, we can store the same connection // again with the same key and retrieve it. func TestReuse1(t *testing.T) { var table connTable table.Init() defer table.Stop() // This currently panics due to issue #13. conn := makeTestConn() table.Notify("foo", conn) timing.Elapse(c_SOCKET_EXPIRY) timing.Elapse(time.Nanosecond) table.Notify("foo", conn) if table.GetConn("foo") != conn { t.FailNow() } }