package Ġch . r jen ni . exam scheduler . helpers Ċ Ċ import Ġorg . springframework . boot . test . context . Test Component Ċ import Ġorg . springframework . context . event . EventListener Ċ import Ġorg . springframework . web . socket . messaging . Session Subscribe Event Ċ import Ġjava . util . concurrent . Concurrent HashMap Ċ import Ġjava . util . concurrent . Count DownLatch Ċ Ċ @ Test Component Ċ class ĠWebSocket Subscription TestHelper Ġ{ ĊĠĠĠ Ġval Ġsubscription To Id Map Ġ= ĠConcurrent HashMap < String , ĠString >() ĊĠĠĠ Ġvar Ġreceived Subscriptions Count DownLatch Ġ= ĠCount DownLatch ( 1 ) ĊĊĠĠĠ Ġ@ EventListener ĊĠĠĠ Ġfun Ġhandle Session Sub scribed ( event : ĠSession Subscribe Event ) Ġ{ ĊĠĠĠĠĠĠĠ Ġsubscription To Id Map [ event . message . headers [" simp Subscription Id "] Ġas ĠString ] Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġevent . message . headers [" simp SessionId "] Ġas ĠString ĊĠĠĠĠĠĠĠ Ġreceived Subscriptions Count DownLatch . count Down () ĊĠĠĠ Ġ} Ċ } Ċ