WebSocketContextImpl implements WebSocketContext { void remove(ChannelImpl<?, ?> channel) { channels.remove(channel.id); for (String room : channel.rooms) { rooms.get(room).remove(channel.id); } }  @SuppressWarnings("unchecked") @Override List<Channel<V>> all(); @SuppressWarnings("unchecked") @Override List<Channel<V>> room(String name);  }
@Test void remove() { var channel = new ChannelImpl<TestWebSocketMessage, TestWebSocketMessage>(null, context, null); channel.join("room1"); channel.join("room2"); context.remove(channel); assertThat(context.room("room1")).isEmpty(); assertThat(context.room("room2")).isEmpty(); }