### Question:
DeFiReplyMessageProcessor extends AbstractSendMessageProcessor implements NettyRequestProcessor { @Override public RemotingCommand processRequest(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException { SendMessageContext mqtraceContext = null; switch (request.getCode()) { case DeFiBusRequestCode.SEND_DIRECT_MESSAGE_V2: case DeFiBusRequestCode.SEND_DIRECT_MESSAGE: SendMessageRequestHeader requestHeader = parseRequestHeader(request); if (requestHeader == null) { return null; } mqtraceContext = buildMsgContext(ctx, requestHeader); this.executeSendMessageHookBefore(ctx, request, mqtraceContext); final RemotingCommand response = this.processReplyMessageRequest(ctx, request, mqtraceContext, requestHeader); this.executeSendMessageHookAfter(response, mqtraceContext); return response; default: log.warn("Unsupported request code :" + request.getCode()); } return null; } DeFiReplyMessageProcessor(final DeFiBrokerController deFiBrokerController); @Override RemotingCommand processRequest(ChannelHandlerContext ctx,
        RemotingCommand request); @Override boolean rejectRequest(); SocketAddress getStoreHost(); void processRequestLater(ChannelHandlerContext ctx, RemotingCommand request);  }### Answer:
@Test public void assertReplyResult() throws RemotingCommandException { final RemotingCommand request = createReplyMsgCommand(DeFiBusRequestCode.SEND_DIRECT_MESSAGE); final RemotingCommand[] response = new RemotingCommand[1]; doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { response[0] = (RemotingCommand) invocation.getArguments()[0]; return null; } }).when(channelHandlerContext).writeAndFlush(any(Object.class)); RemotingCommand responseToReturn = deFiReplyMessageProcessor.processRequest(channelHandlerContext, request); if (responseToReturn != null) { Assert.assertNull(response[0]); response[0] = responseToReturn; } Assert.assertEquals(response[0].getCode(), ResponseCode.SUCCESS); Assert.assertEquals(response[0].getOpaque(), request.getOpaque()); }