WebSocketContextImpl implements WebSocketContext { void join(ChannelImpl<?, ?> channel, String room) { logger.debug("join room, channel={}, room={}", channel.id, room); channel.rooms.add(room); rooms.computeIfAbsent(room, key -> new ConcurrentHashMap<>()).put(channel.id, channel); }  @SuppressWarnings("unchecked") @Override List<Channel<V>> all(); @SuppressWarnings("unchecked") @Override List<Channel<V>> room(String name);  }
@Test void join() { var channel = new ChannelImpl<TestWebSocketMessage, TestWebSocketMessage>(null, context, null); channel.join("room1"); List<Channel<TestWebSocketMessage>> room = context.room("room1"); assertThat(room).containsOnly(channel); channel.leave("room1"); assertThat(context.room("room1")).isEmpty(); }