### Question:
ChatManager { public final boolean processChatAsyn(User user, BceChat chat) { boolean send = true; Room room = null; if ( user == null ) return false; if ( user.getStatus() == UserStatus.CHAT_DISABLE ) { logger.debug("User {} is forbidden to chat.", user.getRoleName()); send = false; } else { ChatType chatType = null; if ( chat.getMsgType() >= 0 && chat.getMsgType() < ChatType.values().length ) { chatType = ChatType.values()[chat.getMsgType()]; } if ( chatType == ChatType.ChatPrivate || chatType == ChatType.ChatWorld || chatType == ChatType.ChatCurrent ) { send = true; } else { if ( !user.isVip() ) { Long lastMillis = (Long)user.getUserData(USER_KEY); if ( lastMillis != null ) { int coolDownMillis = GameDataManager.getInstance(). getGameDataAsInt(GameDataKey.CHAT_USER_COOLDOWN, 15000); if ( System.currentTimeMillis() < lastMillis.longValue() + coolDownMillis ) { SysMessageManager.getInstance().sendClientInfoMessage( user, "chat.freq", Type.NORMAL); send = false; } } } } } if ( send ) { ChatMessage chatMessage = new ChatMessage(); chatMessage.user = user; chatMessage.chat = chat; chatMessage.room = room; queue.offer(chatMessage); user.putUserData(USER_KEY, System.currentTimeMillis()); Stat.getInstance().chatBuffered++; } return send; } ChatManager(); static final ChatManager getInstance(); void reload(); final void importWord(String wordFileName, TreeSet<String> wordSet); Set<String> getFilteredWord(); String getFilteredWordRegex(TreeSet<String> wordSet); String filterWord(String userWord); boolean hasFilterWord(Pattern pattern, String userWord); boolean containBadWord(String userWord); final boolean processChatAsyn(User user, BceChat chat); final boolean processVoiceChatAsyn(User user, BceVoiceChat chat); final void processChatToWorldAsyn(User user, String content); final void sendSysChat(User toUser, String content); final void sendPrivateSysChat(SessionKey userSessionKey, String content); final void processChat(User user, BceChat chat, Room room); final void processVoiceChat(User user, BceVoiceChat chat, Room room); final byte[] storeVoiceContent(byte[] content); final byte[] retrieveVoiceContent(String voiceKey); void sendPrivateChat(User user, String toUserId, String content, ChatType chatType);  }### Answer:
@Test public void testProcessChatAsyn() throws Exception { ChatManager chatManager = ChatManager.getInstance(); ArrayList list1 = new ArrayList(); User user1 = prepareUser("test-001", list1); ArrayList list2 = new ArrayList(); User user2 = prepareUser("test-001", list2); BceChat.Builder builder = BceChat.newBuilder(); builder.setMsgContent("hello world"); builder.setMsgType(ChatType.ChatWorld.ordinal()); chatManager.processChatAsyn(user1, builder.build()); Thread.sleep(200); System.out.println(list2); assertEquals(1, list2.size()); XinqiMessage xinqi = (XinqiMessage)list2.get(0); assertEquals(BseChat.class, xinqi.payload.getClass()); }