001: package test.unit.gov.nist.javax.sip.stack;
002:
003: import javax.sip.*;
004: import javax.sip.address.*;
005: import javax.sip.header.*;
006: import javax.sip.message.*;
007:
008: import org.apache.log4j.ConsoleAppender;
009: import org.apache.log4j.Logger;
010: import org.apache.log4j.SimpleLayout;
011:
012: import java.text.ParseException;
013: import java.util.*;
014:
015: import junit.framework.TestCase;
016:
017: public class ServerTransactionRetransmissionTimerTest extends TestCase {
018: public static final boolean callerSendsBye = true;
019:
020: private static Logger logger = Logger
021: .getLogger(ServerTransactionRetransmissionTimerTest.class);
022: static {
023: if (!logger.getAllAppenders().hasMoreElements())
024: logger.addAppender(new ConsoleAppender(new SimpleLayout()));
025: }
026:
027: class Shootist implements SipListener {
028:
029: private SipProvider sipProvider;
030:
031: private AddressFactory addressFactory;
032:
033: private MessageFactory messageFactory;
034:
035: private HeaderFactory headerFactory;
036:
037: private SipStack sipStack;
038:
039: private ContactHeader contactHeader;
040:
041: private ListeningPoint udpListeningPoint;
042:
043: private ClientTransaction inviteTid;
044:
045: private Dialog dialog;
046:
047: private long startTime = System.currentTimeMillis();
048:
049: private boolean byeTaskRunning;
050:
051: class ByeTask extends TimerTask {
052: Dialog dialog;
053:
054: public ByeTask(Dialog dialog) {
055: this .dialog = dialog;
056: }
057:
058: public void run() {
059: try {
060: Request byeRequest = this .dialog
061: .createRequest(Request.BYE);
062: ClientTransaction ct = sipProvider
063: .getNewClientTransaction(byeRequest);
064: logger.info("15s are over: sending BYE now");
065: dialog.sendRequest(ct);
066: } catch (Exception ex) {
067: ex.printStackTrace();
068: System.exit(0);
069: }
070:
071: }
072:
073: }
074:
075: private static final String usageString = "java "
076: + "examples.shootist.Shootist \n"
077: + ">>>> is your class path set to the root?";
078:
079: public void processRequest(RequestEvent requestReceivedEvent) {
080: Request request = requestReceivedEvent.getRequest();
081: ServerTransaction serverTransactionId = requestReceivedEvent
082: .getServerTransaction();
083:
084: logger.info("\n\nRequest " + request.getMethod()
085: + " received at " + sipStack.getStackName()
086: + " with server transaction id "
087: + serverTransactionId);
088:
089: // We are the UAC so the only request we get is the BYE.
090: if (request.getMethod().equals(Request.BYE))
091: processBye(request, serverTransactionId);
092: else {
093: try {
094: serverTransactionId.sendResponse(messageFactory
095: .createResponse(202, request));
096: } catch (Exception e) {
097: fail("Unexpected exception");
098: logger.error("Unexpected exception", e);
099: }
100: }
101:
102: }
103:
104: public void processBye(Request request,
105: ServerTransaction serverTransactionId) {
106: try {
107: logger.info("shootist: got a bye .");
108: if (serverTransactionId == null) {
109: logger.info("shootist: null TID.");
110: return;
111: }
112: Dialog dialog = serverTransactionId.getDialog();
113: logger.info("Dialog State = " + dialog.getState());
114: Response response = messageFactory.createResponse(200,
115: request);
116: serverTransactionId.sendResponse(response);
117: logger.info("shootist: Sending OK.");
118: logger.info("Dialog State = " + dialog.getState());
119:
120: } catch (Exception ex) {
121: ex.printStackTrace();
122: System.exit(0);
123:
124: }
125: }
126:
127: // Save the created ACK request, to respond to retransmitted 2xx
128: private Request ackRequest;
129:
130: public void processResponse(ResponseEvent responseReceivedEvent) {
131: logger.info(System.currentTimeMillis() - startTime
132: + "ms: Got a response");
133: Response response = (Response) responseReceivedEvent
134: .getResponse();
135: ClientTransaction tid = responseReceivedEvent
136: .getClientTransaction();
137: CSeqHeader cseq = (CSeqHeader) response
138: .getHeader(CSeqHeader.NAME);
139:
140: logger.info("Response received : Status Code = "
141: + response.getStatusCode() + " " + cseq);
142:
143: if (tid == null) {
144:
145: // RFC3261: MUST respond to every 2xx
146: if (ackRequest != null && dialog != null) {
147: logger.info("re-sending ACK");
148: try {
149: dialog.sendAck(ackRequest);
150: } catch (SipException se) {
151: se.printStackTrace();
152: }
153: }
154: return;
155: }
156: // If the caller is supposed to send the bye
157: if (callerSendsBye && !byeTaskRunning) {
158: byeTaskRunning = true;
159: new Timer().schedule(new ByeTask(dialog), 30000); // Frank
160: // Reif:
161: // modified
162: // from 4000
163: // to 15000
164: // to allow
165: // delayed-ack
166: // demo
167: }
168: logger.info("transaction state is " + tid.getState());
169: logger.info("Dialog = " + tid.getDialog());
170: logger
171: .info("Dialog State is "
172: + tid.getDialog().getState());
173:
174: try {
175: if (response.getStatusCode() == Response.OK) {
176: if (cseq.getMethod().equals(Request.INVITE)) {
177:
178: // *****************************************************************
179: // BEGIN
180: // Frank Reif: delayed-ack after 6s
181: logger.info("Sending ACK after 15s ...");
182: new Timer().schedule(new AckTimerTask(dialog,
183: cseq.getSeqNumber()), 15000);
184:
185: // JvB: test REFER, reported bug in tag handling
186: // dialog.sendRequest(
187: // sipProvider.getNewClientTransaction(
188: // dialog.createRequest("REFER") ));
189:
190: // *****************************************************************
191: // END
192:
193: } else if (cseq.getMethod().equals(Request.CANCEL)) {
194: if (dialog.getState() == DialogState.CONFIRMED) {
195: // oops cancel went in too late. Need to hang up the
196: // dialog.
197: System.out
198: .println("Sending BYE -- cancel went in too late !!");
199: Request byeRequest = dialog
200: .createRequest(Request.BYE);
201: ClientTransaction ct = sipProvider
202: .getNewClientTransaction(byeRequest);
203: dialog.sendRequest(ct);
204:
205: }
206:
207: }
208: }
209: } catch (Exception ex) {
210: logger.error("Unexpected exception", ex);
211: fail("Unexpected exception");
212:
213: }
214:
215: }
216:
217: // *****************************************************************
218: // BEGIN
219: // Frank Reif: delayed-ack after 10s
220: class AckTimerTask extends TimerTask {
221: Dialog dialog;
222: private final long cseq;
223:
224: public AckTimerTask(Dialog dialog, long cseq) {
225: this .dialog = dialog;
226: this .cseq = cseq;
227: }
228:
229: public void run() {
230: logger.info("15s are over: now sending ACK");
231: try {
232: Request ackRequest = dialog.createAck(cseq);
233: dialog.sendAck(ackRequest);
234: } catch (Exception e) {
235: logger.error("Unexpected exception", e);
236: fail("Unexpected exception");
237: }
238: }
239: }
240:
241: // ***************************************************************** END
242:
243: public void processTimeout(javax.sip.TimeoutEvent timeoutEvent) {
244:
245: logger.info("Transaction Time out");
246: fail("Unexpected exception -- ");
247: }
248:
249: public void init() {
250: SipFactory sipFactory = null;
251: sipStack = null;
252: sipFactory = SipFactory.getInstance();
253: sipFactory.setPathName("gov.nist");
254: Properties properties = new Properties();
255: // If you want to try TCP transport change the following to
256: String transport = "udp";
257: String peerHostPort = "127.0.0.1:5070";
258: properties.setProperty("javax.sip.OUTBOUND_PROXY",
259: peerHostPort + "/" + transport);
260: // If you want to use UDP then uncomment this.
261: properties.setProperty("javax.sip.STACK_NAME", "shootist");
262:
263: // The following properties are specific to nist-sip
264: // and are not necessarily part of any other jain-sip
265: // implementation.
266: // You can set a max message size for tcp transport to
267: // guard against denial of service attack.
268: properties.setProperty("gov.nist.javax.sip.DEBUG_LOG",
269: "logs/shootistdebug.txt");
270: properties.setProperty("gov.nist.javax.sip.SERVER_LOG",
271: "logs/shootistlog.txt");
272:
273: // Drop the client connection after we are done with the
274: // transaction.
275: properties.setProperty(
276: "gov.nist.javax.sip.CACHE_CLIENT_CONNECTIONS",
277: "false");
278: // Set to 0 (or NONE) in your production code for max speed.
279: // You need 16 (or TRACE) for logging traces. 32 (or DEBUG) for
280: // debug + traces.
281: // Your code will limp at 32 but it is best for debugging.
282: properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL",
283: "0");
284:
285: try {
286: // Create SipStack object
287: sipStack = sipFactory.createSipStack(properties);
288: logger.info("createSipStack " + sipStack);
289: } catch (PeerUnavailableException e) {
290: // could not find
291: // gov.nist.jain.protocol.ip.sip.SipStackImpl
292: // in the classpath
293: e.printStackTrace();
294: System.err.println(e.getMessage());
295: System.exit(0);
296: }
297:
298: try {
299: headerFactory = sipFactory.createHeaderFactory();
300: addressFactory = sipFactory.createAddressFactory();
301: messageFactory = sipFactory.createMessageFactory();
302: udpListeningPoint = sipStack.createListeningPoint(
303: "127.0.0.1", 5060, "udp");
304: sipProvider = sipStack
305: .createSipProvider(udpListeningPoint);
306: Shootist listener = this ;
307: sipProvider.addSipListener(listener);
308:
309: String fromName = "BigGuy";
310: String fromSipAddress = "here.com";
311: String fromDisplayName = "The Master Blaster";
312:
313: String toSipAddress = "there.com";
314: String toUser = "LittleGuy";
315: String toDisplayName = "The Little Blister";
316:
317: // create >From Header
318: SipURI fromAddress = addressFactory.createSipURI(
319: fromName, fromSipAddress);
320:
321: Address fromNameAddress = addressFactory
322: .createAddress(fromAddress);
323: fromNameAddress.setDisplayName(fromDisplayName);
324: FromHeader fromHeader = headerFactory.createFromHeader(
325: fromNameAddress, "12345");
326:
327: // create To Header
328: SipURI toAddress = addressFactory.createSipURI(toUser,
329: toSipAddress);
330: Address toNameAddress = addressFactory
331: .createAddress(toAddress);
332: toNameAddress.setDisplayName(toDisplayName);
333: ToHeader toHeader = headerFactory.createToHeader(
334: toNameAddress, null);
335:
336: // create Request URI
337: SipURI requestURI = addressFactory.createSipURI(toUser,
338: peerHostPort);
339:
340: // Create ViaHeaders
341:
342: ArrayList viaHeaders = new ArrayList();
343: String ipAddress = udpListeningPoint.getIPAddress();
344: ViaHeader viaHeader = headerFactory.createViaHeader(
345: ipAddress, sipProvider.getListeningPoint(
346: transport).getPort(), transport, null);
347:
348: // add via headers
349: viaHeaders.add(viaHeader);
350:
351: // Create ContentTypeHeader
352: ContentTypeHeader contentTypeHeader = headerFactory
353: .createContentTypeHeader("application", "sdp");
354:
355: // Create a new CallId header
356: CallIdHeader callIdHeader = sipProvider.getNewCallId();
357:
358: // Create a new Cseq header
359: CSeqHeader cSeqHeader = headerFactory.createCSeqHeader(
360: 1L, Request.INVITE);
361:
362: // Create a new MaxForwardsHeader
363: MaxForwardsHeader maxForwards = headerFactory
364: .createMaxForwardsHeader(70);
365:
366: // Create the request.
367: Request request = messageFactory.createRequest(
368: requestURI, Request.INVITE, callIdHeader,
369: cSeqHeader, fromHeader, toHeader, viaHeaders,
370: maxForwards);
371: // Create contact headers
372: String host = "127.0.0.1";
373:
374: SipURI contactUrl = addressFactory.createSipURI(
375: fromName, host);
376: contactUrl.setPort(udpListeningPoint.getPort());
377: contactUrl.setLrParam();
378:
379: // Create the contact name address.
380: SipURI contactURI = addressFactory.createSipURI(
381: fromName, host);
382: contactURI.setPort(sipProvider.getListeningPoint(
383: transport).getPort());
384:
385: Address contactAddress = addressFactory
386: .createAddress(contactURI);
387:
388: // Add the contact address.
389: contactAddress.setDisplayName(fromName);
390:
391: contactHeader = headerFactory
392: .createContactHeader(contactAddress);
393: request.addHeader(contactHeader);
394:
395: // You can add extension headers of your own making
396: // to the outgoing SIP request.
397: // Add the extension header.
398: Header extensionHeader = headerFactory.createHeader(
399: "My-Header", "my header value");
400: request.addHeader(extensionHeader);
401:
402: String sdpData = "v=0\r\n"
403: + "o=4855 13760799956958020 13760799956958020"
404: + " IN IP4 129.6.55.78\r\n"
405: + "s=mysession session\r\n"
406: + "p=+46 8 52018010\r\n"
407: + "c=IN IP4 129.6.55.78\r\n" + "t=0 0\r\n"
408: + "m=audio 6022 RTP/AVP 0 4 18\r\n"
409: + "a=rtpmap:0 PCMU/8000\r\n"
410: + "a=rtpmap:4 G723/8000\r\n"
411: + "a=rtpmap:18 G729A/8000\r\n"
412: + "a=ptime:20\r\n";
413: byte[] contents = sdpData.getBytes();
414:
415: request.setContent(contents, contentTypeHeader);
416: // You can add as many extension headers as you
417: // want.
418:
419: extensionHeader = headerFactory.createHeader(
420: "My-Other-Header", "my new header value ");
421: request.addHeader(extensionHeader);
422:
423: Header callInfoHeader = headerFactory.createHeader(
424: "Call-Info", "<http://www.antd.nist.gov>");
425: request.addHeader(callInfoHeader);
426:
427: // Create the client transaction.
428: inviteTid = sipProvider
429: .getNewClientTransaction(request);
430:
431: // send the request out.
432: inviteTid.sendRequest();
433:
434: dialog = inviteTid.getDialog();
435:
436: } catch (Exception ex) {
437: logger.error("Unexpected exception", ex);
438: fail("Unexpected exception ");
439: }
440: }
441:
442: public void processIOException(IOExceptionEvent exceptionEvent) {
443: logger.error("IOException happened for "
444: + exceptionEvent.getHost() + " port = "
445: + exceptionEvent.getPort());
446:
447: }
448:
449: public void processTransactionTerminated(
450: TransactionTerminatedEvent transactionTerminatedEvent) {
451: if (transactionTerminatedEvent.getServerTransaction() != null)
452: logger
453: .info("Shootist: Transaction terminated event recieved on transaction : "
454: + transactionTerminatedEvent
455: .getServerTransaction());
456: else
457: logger
458: .info("Shootist : Transaction terminated event recieved on transaction : "
459: + transactionTerminatedEvent
460: .getClientTransaction());
461: }
462:
463: public void processDialogTerminated(
464: DialogTerminatedEvent dialogTerminatedEvent) {
465: logger.info("dialogTerminatedEvent");
466:
467: }
468:
469: public void terminate() {
470: sipStack.stop();
471: }
472: }
473:
474: public class Shootme implements SipListener {
475:
476: private AddressFactory addressFactory;
477:
478: private MessageFactory messageFactory;
479:
480: private HeaderFactory headerFactory;
481:
482: private SipStack sipStack;
483:
484: private static final String myAddress = "127.0.0.1";
485:
486: private static final int myPort = 5070;
487:
488: protected ServerTransaction inviteTid;
489:
490: private Response okResponse;
491:
492: private Request inviteRequest;
493:
494: private Dialog dialog;
495:
496: class MyTimerTask extends TimerTask {
497: Shootme shootme;
498:
499: public MyTimerTask(Shootme shootme) {
500: this .shootme = shootme;
501:
502: }
503:
504: public void run() {
505: shootme.sendInviteOK();
506: }
507:
508: }
509:
510: protected static final String usageString = "java "
511: + "examples.shootist.Shootist \n"
512: + ">>>> is your class path set to the root?";
513:
514: public void processRequest(RequestEvent requestEvent) {
515: Request request = requestEvent.getRequest();
516: ServerTransaction serverTransactionId = requestEvent
517: .getServerTransaction();
518:
519: logger.info("\n\nRequest " + request.getMethod()
520: + " received at " + sipStack.getStackName()
521: + " with server transaction id "
522: + serverTransactionId);
523:
524: if (request.getMethod().equals(Request.INVITE)) {
525: processInvite(requestEvent, serverTransactionId);
526: } else if (request.getMethod().equals(Request.ACK)) {
527: processAck(requestEvent, serverTransactionId);
528: } else if (request.getMethod().equals(Request.BYE)) {
529: processBye(requestEvent, serverTransactionId);
530: } else if (request.getMethod().equals(Request.CANCEL)) {
531: processCancel(requestEvent, serverTransactionId);
532: } else {
533: try {
534: serverTransactionId.sendResponse(messageFactory
535: .createResponse(202, request));
536:
537: // send one back
538: SipProvider prov = (SipProvider) requestEvent
539: .getSource();
540: Request refer = requestEvent.getDialog()
541: .createRequest("REFER");
542: requestEvent.getDialog().sendRequest(
543: prov.getNewClientTransaction(refer));
544:
545: } catch (Exception e) {
546: fail("Unexpected exception");
547: }
548: }
549:
550: }
551:
552: public void processResponse(ResponseEvent responseEvent) {
553: fail("Unexpected event");
554: }
555:
556: /**
557: * Process the ACK request. Send the bye and complete the call flow.
558: */
559: public void processAck(RequestEvent requestEvent,
560: ServerTransaction serverTransaction) {
561: try {
562: logger.info("shootme: got an ACK! ");
563: logger.info("Dialog State = " + dialog.getState());
564: SipProvider provider = (SipProvider) requestEvent
565: .getSource();
566: if (!callerSendsBye) {
567: Request byeRequest = dialog
568: .createRequest(Request.BYE);
569: ClientTransaction ct = provider
570: .getNewClientTransaction(byeRequest);
571: dialog.sendRequest(ct);
572: }
573: } catch (Exception ex) {
574: logger.error("Unexpected exception", ex);
575: fail("unexpected exception");
576: }
577:
578: }
579:
580: /**
581: * Process the invite request.
582: */
583: public void processInvite(RequestEvent requestEvent,
584: ServerTransaction serverTransaction) {
585: SipProvider sipProvider = (SipProvider) requestEvent
586: .getSource();
587: Request request = requestEvent.getRequest();
588: try {
589: logger.info("shootme: got an Invite sending Trying");
590: // logger.info("shootme: " + request);
591: Response response = messageFactory.createResponse(
592: Response.TRYING, request);
593: ServerTransaction st = requestEvent
594: .getServerTransaction();
595:
596: if (st == null) {
597: st = sipProvider.getNewServerTransaction(request);
598: }
599: dialog = st.getDialog();
600:
601: st.sendResponse(response);
602:
603: this .okResponse = messageFactory.createResponse(
604: Response.OK, request);
605: Address address = addressFactory
606: .createAddress("Shootme <sip:" + myAddress
607: + ":" + myPort + ">");
608: ContactHeader contactHeader = headerFactory
609: .createContactHeader(address);
610: response.addHeader(contactHeader);
611: ToHeader toHeader = (ToHeader) okResponse
612: .getHeader(ToHeader.NAME);
613: toHeader.setTag("4321"); // Application is supposed to set.
614: okResponse.addHeader(contactHeader);
615: this .inviteTid = st;
616: // Defer sending the OK to simulate the phone ringing.
617: // Answered in 1 second ( this guy is fast at taking calls)
618: this .inviteRequest = request;
619:
620: new Timer().schedule(new MyTimerTask(this ), 1000);
621: } catch (Exception ex) {
622: logger.error("Unexpected exception");
623: fail("Unexpected exception");
624: }
625: }
626:
627: private void sendInviteOK() {
628: try {
629: if (inviteTid.getState() != TransactionState.COMPLETED) {
630: logger.info("shootme: Dialog state before 200: "
631: + inviteTid.getDialog().getState());
632: inviteTid.sendResponse(okResponse);
633: logger.info("shootme: Dialog state after 200: "
634: + inviteTid.getDialog().getState());
635: }
636: } catch (Exception ex) {
637: logger.error("Unexpected exception", ex);
638: fail("Unexpected exception");
639: }
640: }
641:
642: /**
643: * Process the bye request.
644: */
645: public void processBye(RequestEvent requestEvent,
646: ServerTransaction serverTransactionId) {
647: SipProvider sipProvider = (SipProvider) requestEvent
648: .getSource();
649: Request request = requestEvent.getRequest();
650: Dialog dialog = requestEvent.getDialog();
651: logger.info("shootme: local party = "
652: + dialog.getLocalParty());
653: try {
654: logger.info("shootme: got a bye sending OK.");
655: Response response = messageFactory.createResponse(200,
656: request);
657: serverTransactionId.sendResponse(response);
658: logger.info("shootme: Dialog State is "
659: + serverTransactionId.getDialog().getState());
660:
661: } catch (Exception ex) {
662: logger.error("UNexpected exception", ex);
663: fail("UNexpected exception");
664:
665: }
666: }
667:
668: public void processCancel(RequestEvent requestEvent,
669: ServerTransaction serverTransactionId) {
670: SipProvider sipProvider = (SipProvider) requestEvent
671: .getSource();
672: Request request = requestEvent.getRequest();
673: try {
674: logger.info("shootme: got a cancel.");
675: if (serverTransactionId == null) {
676: logger.info("shootme: null tid.");
677: return;
678: }
679: Response response = messageFactory.createResponse(200,
680: request);
681: serverTransactionId.sendResponse(response);
682: if (dialog.getState() != DialogState.CONFIRMED) {
683: response = messageFactory.createResponse(
684: Response.REQUEST_TERMINATED, inviteRequest);
685: inviteTid.sendResponse(response);
686: }
687:
688: } catch (Exception ex) {
689: ex.printStackTrace();
690: System.exit(0);
691:
692: }
693: }
694:
695: public void processTimeout(javax.sip.TimeoutEvent timeoutEvent) {
696: Transaction transaction;
697: if (timeoutEvent.isServerTransaction()) {
698: transaction = timeoutEvent.getServerTransaction();
699: } else {
700: transaction = timeoutEvent.getClientTransaction();
701: }
702: logger.info("Shootme: Transaction Time out : "
703: + transaction);
704: }
705:
706: public void init() {
707: SipFactory sipFactory = null;
708: sipStack = null;
709: sipFactory = SipFactory.getInstance();
710: sipFactory.setPathName("gov.nist");
711: Properties properties = new Properties();
712: properties.setProperty("javax.sip.STACK_NAME", "shootme");
713: // You need 16 for logging traces. 32 for debug + traces.
714: // Your code will limp at 32 but it is best for debugging.
715: properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL",
716: "0");
717: properties.setProperty("gov.nist.javax.sip.DEBUG_LOG",
718: "shootmedebug.txt");
719: properties.setProperty("gov.nist.javax.sip.SERVER_LOG",
720: "shootmelog.txt");
721:
722: try {
723: // Create SipStack object
724: sipStack = sipFactory.createSipStack(properties);
725: logger.info("sipStack = " + sipStack);
726: } catch (PeerUnavailableException e) {
727: // could not find
728: // gov.nist.jain.protocol.ip.sip.SipStackImpl
729: // in the classpath
730: e.printStackTrace();
731: System.err.println(e.getMessage());
732: if (e.getCause() != null)
733: e.getCause().printStackTrace();
734: logger.error("Unexpected error creating stack", e);
735: fail("Unexpected error");
736: }
737:
738: try {
739: headerFactory = sipFactory.createHeaderFactory();
740: addressFactory = sipFactory.createAddressFactory();
741: messageFactory = sipFactory.createMessageFactory();
742: ListeningPoint lp = sipStack.createListeningPoint(
743: "127.0.0.1", myPort, "udp");
744:
745: Shootme listener = this ;
746:
747: SipProvider sipProvider = sipStack
748: .createSipProvider(lp);
749: logger.info("udp provider " + sipProvider);
750: sipProvider.addSipListener(listener);
751:
752: } catch (Exception ex) {
753: fail("Unexpected exception");
754: }
755:
756: }
757:
758: public void terminate() {
759: this .sipStack.stop();
760: }
761:
762: public void processIOException(IOExceptionEvent exceptionEvent) {
763: logger.info("IOException");
764:
765: }
766:
767: public void processTransactionTerminated(
768: TransactionTerminatedEvent transactionTerminatedEvent) {
769: if (transactionTerminatedEvent.isServerTransaction())
770: logger.info("Transaction terminated event recieved"
771: + transactionTerminatedEvent
772: .getServerTransaction());
773: else
774: logger.info("Transaction terminated "
775: + transactionTerminatedEvent
776: .getClientTransaction());
777:
778: }
779:
780: public void processDialogTerminated(
781: DialogTerminatedEvent dialogTerminatedEvent) {
782: logger.info("Shootme: Dialog terminated event recieved");
783: Dialog d = dialogTerminatedEvent.getDialog();
784: logger.info("Local Party = " + d.getLocalParty());
785:
786: }
787:
788: }
789:
790: private Shootist shootist;
791: private Shootme shootme;
792:
793: public void setUp() {
794: this .shootme = new Shootme();
795: this .shootist = new Shootist();
796:
797: }
798:
799: public void tearDown() {
800: shootist.terminate();
801: shootme.terminate();
802: }
803:
804: public void testRetransmit() {
805: this .shootme.init();
806: this .shootist.init();
807: try {
808: Thread.sleep(60000);
809: } catch (Exception ex) {
810:
811: }
812: }
813:
814: }
|