### Question:
AbstractSessionHandler extends MessageToMessageCodec<FixMessage, FixMessageBuilder> { protected void sendReject(ChannelHandlerContext ctx, FixMessage originalMsg, boolean closeConnection) { final FixMessageBuilderImpl reject = createReject(originalMsg); ChannelFuture channelFuture = ctx.writeAndFlush(reject); if (closeConnection) { channelFuture.addListener(ChannelFutureListener.CLOSE); } } protected  AbstractSessionHandler(FixApplication fixApplication,
                                     FixClock fixClock,
                                     SessionRepository sessionRepository); @Override void channelInactive(ChannelHandlerContext ctx); @Override void exceptionCaught(ChannelHandlerContext ctx, Throwable cause); static final AttributeKey<FixSession> FIX_SESSION_KEY; }### Answer:
@Test public void testSendReject() { String msgType = randomAscii(3); FixMessage originalMsg = mock(FixMessage.class); int originalMsgSeqNum = RANDOM.nextInt(); when(originalMsg.getMessageType()).thenReturn(msgType); when(originalMsg.getInt(FieldType.MsgSeqNum.tag())).thenReturn(originalMsgSeqNum); sessionHandler.sendReject(ctx, originalMsg, false); verify(ctx, times(1)).writeAndFlush(rejectCaptor.capture()); FixMessage reject = rejectCaptor.getValue(); assertEquals(MessageTypes.REJECT, reject.getMessageType()); assertEquals(msgType, reject.getString(FieldType.RefMsgType.tag())); assertEquals((Integer) originalMsgSeqNum, reject.getInt(FieldType.RefSeqNum.tag())); }