### Question:
FIXTransportSender extends AbstractTransportSender { public void sendMessage(MessageContext msgCtx, String targetEPR, OutTransportInfo outTransportInfo) throws AxisFault { if (log.isDebugEnabled()) { log.debug("Attempting to send a FIX message, Message ID:" + msgCtx.getMessageID()); } Message fixMessage = null; String serviceName = FIXUtils.getServiceName(msgCtx); String fixApplication = FIXUtils.getFixApplication(msgCtx); String sourceSession = FIXUtils.getSourceSession(msgCtx); int counter = FIXUtils.getSequenceNumber(msgCtx); try { fixMessage = FIXUtils.getInstance().createFIXMessage(msgCtx); } catch (IOException e) { handleException("Exception occurred while creating the FIX message from SOAP Envelope", e); } if (FIXConstants.FIX_ACCEPTOR.equals(fixApplication)) { if (targetEPR != null) { sendUsingEPR(targetEPR, serviceName, fixMessage, sourceSession, counter, msgCtx); } else if (outTransportInfo != null && outTransportInfo instanceof FIXOutTransportInfo) { sendUsingTrpOutInfo(outTransportInfo, serviceName, fixMessage, sourceSession, counter, msgCtx); } } else if (FIXConstants.FIX_INITIATOR.equals(fixApplication)) { if (sendUsingAcceptorSession(serviceName, fixMessage, sourceSession, counter, msgCtx)) { return; } else if (targetEPR != null) { sendUsingEPR(targetEPR, serviceName, fixMessage, sourceSession, counter, msgCtx); return; } handleException("Unable to find a session to send the message..."); } else { if (targetEPR != null) { sendUsingEPR(targetEPR, serviceName, fixMessage, sourceSession, counter, msgCtx); } else { sendUsingAcceptorSession(serviceName, fixMessage, sourceSession, counter, msgCtx); } } } FIXTransportSender(); void init(ConfigurationContext cfgCtx, TransportOutDescription transportOut); void stop(); void sendMessage(MessageContext msgCtx, String targetEPR,
                            OutTransportInfo outTransportInfo); void logOutIncomingSession(SessionID sessionID);  }### Answer:
@Test() public void testFIXTransportSenderSendMessage() throws Exception { String BEGIN_STRING = "FIX.4.1"; String SENDER_ID = "BANZAI"; String TARGET_ID = "SYNAPSE"; int SEQ_NUM = 5; String SYMBOL = "APACHE"; String CLORD_ID = "12345"; String CHECKSUM = "67890"; String TX_DATE = new Date().toString(); String SESSION_ID = "FIX.4.1:BANZAI->SYNAPSE"; Message message = new NewOrderSingle(); message.getHeader().setField(new BeginString(BEGIN_STRING)); message.getHeader().setField(new SenderCompID(SENDER_ID)); message.getHeader().setField(new TargetCompID(TARGET_ID)); message.getHeader().setField(new MsgSeqNum(SEQ_NUM)); message.setField(new Symbol(SYMBOL)); message.setField(new ClOrdID(CLORD_ID)); message.setField(new TradeOriginationDate(TX_DATE)); message.getTrailer().setField(new CheckSum(CHECKSUM)); MessageContext msgCtx = new MessageContext(); msgCtx.setProperty(FIXConstants.FIX_SERVICE_NAME, "sampleService"); Map trpHeaders = new HashMap(); trpHeaders.put(FIXConstants.FIX_MESSAGE_APPLICATION, "sampleApplication"); msgCtx.setProperty(MessageContext.TRANSPORT_HEADERS, trpHeaders); FIXUtils.getInstance().setSOAPEnvelope(message, SEQ_NUM, SESSION_ID, msgCtx); OutTransportInfo info = new FIXOutTransportInfo("fix: FIXTransportSender spy = PowerMockito.spy(new FIXTransportSender()); PowerMockito.doReturn(true) .when(spy, "sendUsingEPR", anyString(), anyString(), any(), anyString(), anyInt(), any()); spy.sendMessage(msgCtx, "fix: PowerMockito.verifyPrivate(spy, times(1)) .invoke("sendUsingEPR", anyString(), anyString(), any(), anyString(), anyInt(), any()); }