diff --git a/server/client_test.go b/server/client_test.go index 3d16f553..ee7d5edb 100644 --- a/server/client_test.go +++ b/server/client_test.go @@ -11,6 +11,7 @@ import ( "regexp" "strings" "testing" + "time" ) type serverInfo struct { @@ -375,3 +376,17 @@ func TestClientRemoveSubsOnDisconnect(t *testing.T) { t.Fatalf("Should have no subscriptions after close, got %d\n", s.sl.Count()) } } + +func TestClientMapRemoval(t *testing.T) { + s, c, _ := setupClient() + c.conn.Close() + end := time.Now().Add(1 * time.Second) + for time.Now().Before(end) { + if len(s.clients) > 0 { + time.Sleep(5 * time.Millisecond) + } + } + if len(s.clients) > 0 { + t.Fatal("Client still in server map") + } +}