Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Conditions Of Use 
   * 
   * This software was developed by employees of the National Institute of
   * Standards and Technology (NIST), and others. 
   * This software is has been contributed to the public domain. 
   * As a result, a formal license is not needed to use the software.
   * 
   * This software is provided "AS IS."  
  * NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
  * OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
  * AND DATA ACCURACY.  NIST does not warrant or make any representations
  * regarding the use of the software or the results thereof, including but
  * not limited to the correctness, accuracy, reliability or usefulness of
  * the software.
  * 
  * 
  */
 
 package test.unit.gov.nist.javax.sip.stack;
 
 
 
 
 
 
 import  test.tck.msgflow.callflows.NonSipUriRouter;
 import  test.tck.msgflow.callflows.ProtocolObjects;
 import  test.tck.msgflow.callflows.ScenarioHarness;
 
 import  junit.framework.TestCase;

Author(s):
M. Ranganathan
 
 public class ReInviteBusyTest extends TestCase {
 
     protected Shootist shootist;
 
     private Shootme shootme;
 
 
 
    protected static final Appender console = new ConsoleAppender(new SimpleLayout());
    protected static Logger logger = Logger.getLogger(ReInviteBusyTest.class);
    
    
    static {
        if (!.isAttached())
            .addAppender();
    }
    private static String PEER_ADDRESS = .;
    private static int PEER_PORT = .;
    private static String peerHostPort =  + ":" + ;
    
    
   
    

Author(s):
M. Ranganathan
    public class ProtocolObjects {
        public final AddressFactory addressFactory;
        public final MessageFactory messageFactory;
        public final HeaderFactory headerFactory;
        public final SipStack sipStack;
        public int logLevel = 32;
        String logFileDirectory = "logs/";
        public final String transport;
        private boolean isStarted;
    	public boolean autoDialog;
    	
        public ProtocolObjects(String stacknameString pathnameString transport,
                boolean autoDialogboolean isBackToBackUserAgent) {
        	this. = autoDialog;
            this. = transport;
            SipFactory sipFactory = SipFactory.getInstance();
            sipFactory.resetFactory();
            sipFactory.setPathName(pathname);
            Properties properties = new Properties();
            properties.setProperty("javax.sip.STACK_NAME"stackname);
            // The following properties are specific to nist-sip
            // and are not necessarily part of any other jain-sip
            // implementation.
            properties.setProperty("gov.nist.javax.sip.DEBUG_LOG"
                    + stackname + "debuglog.txt");
            properties.setProperty("gov.nist.javax.sip.SERVER_LOG",
                     + stackname + "log.txt");
            properties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT",
                    (autoDialog ? "on" : "off"));
            // For the forked subscribe notify test
            properties.setProperty("javax.sip.FORKABLE_EVENTS""foo");
            //For the TelUrlRouter test.
            //properties.setProperty("javax.sip.ROUTER_PATH", NonSipUriRouter.class.getName());
            // Dont use the router for all requests.
            properties.setProperty("javax.sip.USE_ROUTER_FOR_ALL_URIS""false");
            properties.setProperty("gov.nist.javax.sip.THREAD_POOL_SIZE""1");
            
            properties.setProperty("gov.nist.javax.sip.IS_BACK_TO_BACK_USER_AGENT", Boolean.toString(isBackToBackUserAgent));
            //For the TelUrlRouter test.
            properties.setProperty("javax.sip.ROUTER_PATH", NonSipUriRouter.class.getName());
            // Set to 0 in your production code for max speed.
            // You need 16 for logging traces. 32 for debug + traces.
            // Your code will limp at 32 but it is best for debugging.
            properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL"new Integer(
                    ).toString());
            try {
                // Create SipStack object
                 = sipFactory.createSipStack(properties);
                NonSipUriRouter router = (NonSipUriRouter) .getRouter();
                router.setMyPort(5080);
                ..println("createSipStack " + );
            } catch (Exception e) {
                // could not find
                // gov.nist.jain.protocol.ip.sip.SipStackImpl
                // in the classpath
                e.printStackTrace();
                ..println(e.getMessage());
                throw new RuntimeException("Stack failed to initialize");
            }
            try {
                 = sipFactory.createHeaderFactory();
                 = sipFactory.createAddressFactory();
                 = sipFactory.createMessageFactory();
            } catch (SipException ex) {
                ex.printStackTrace();
                throw new RuntimeException(ex);
            }
        }
        public synchronized void destroy() {
            HashSet hashSet = new HashSet();
            for (Iterator it = .getSipProviders(); it.hasNext();) {
                SipProvider sipProvider = (SipProviderit.next();
                hashSet.add(sipProvider);
            }
            for ( Iterator it = hashSet.iterator(); it.hasNext();) {
                SipProvider sipProvider = (SipProviderit.next();
                for (int j = 0; j < 5; j++) {
                    try {
                        .deleteSipProvider(sipProvider);
                    } catch (ObjectInUseException ex) {
                        try {
                            Thread.sleep(1000);
                        } catch (Exception e) {
                        }
                    }
                }
            }
            .stop();
        }
        public void start() throws Exception {
            if (this.)
                return;
            .start();
            this. = true;
        }
    }
    public class Shootme implements SipListener {
        private ProtocolObjects protocolObjects;
        // To run on two machines change these to suit.
        public static final String myAddress = "127.0.0.1";
        public static final int myPort = 5071;
        private ServerTransaction inviteTid;
        private Dialog dialog;
        private boolean okRecieved;
        private int reInviteCount;
        class ApplicationData {
            protected int ackCount;
        }
        public Shootme(ProtocolObjects protocolObjects) {
            this. = protocolObjects;
        }
        public void processRequest(RequestEvent requestEvent) {
            Request request = requestEvent.getRequest();
            ServerTransaction serverTransactionId = requestEvent.getServerTransaction();
            .info("\n\nRequest " + request.getMethod() + " received at "
                    + ..getStackName() + " with server transaction id "
                    + serverTransactionId);
            if (request.getMethod().equals(.)) {
                processInvite(requestEventserverTransactionId);
            } else if (request.getMethod().equals(.)) {
                processAck(requestEventserverTransactionId);
            } else if (request.getMethod().equals(.)) {
                processBye(requestEventserverTransactionId);
            }
        }
        public void processAck(RequestEvent requestEventServerTransaction serverTransaction) {
            SipProvider sipProvider = (SipProviderrequestEvent.getSource();
            try {
                .info("shootme: got an ACK " + requestEvent.getRequest());
               /* int ackCount = ((ApplicationData) dialog.getApplicationData()).ackCount;*/
                 = .getDialog();
                Thread.sleep(1000);
                .info("shootme is sending RE INVITE now");
                ..println("Got an ACK " );
                this.++;
                this.sendReInvite(sipProvider);
            } catch (Exception ex) {
                String s = "Unexpected error";
                .error(sex);
                ReInviteBusyTest.fail(s);
            }
        }

        
Process the invite request.
        public void processInvite(RequestEvent requestEventServerTransaction serverTransaction) {
            SipProvider sipProvider = (SipProviderrequestEvent.getSource();
            Request request = requestEvent.getRequest();
             try {
                ServerTransaction st = requestEvent.getServerTransaction();
                int finalResponse;
                .info("Got an INVITE  " + request + " serverTx = " + st);
                
                if (st == null) {
                    st = sipProvider.getNewServerTransaction(request);
                    .info("Server transaction created!" + request);
                    ..println("Dialog = " + st.getDialog());
                    if (st.getDialog().getApplicationData() == null) {
                        st.getDialog().setApplicationData(new ApplicationData());
                    }
                 
                    finalResponse = 200;
                } else {
                    // If Server transaction is not null, then
                    // this is a re-invite.
                	..println("Dialog = " + st.getDialog());
                       
                    .info("This is a RE INVITE ");
                    this.++;
                    ReInviteBusyTest.assertSame("Dialog mismatch "st.getDialog(), this.);
                    finalResponse = .;
                }
                .info("shootme: got an Invite sending " + finalResponse);
                Response response = ..createResponse(finalResponse,
                        request);
                ToHeader toHeader = (ToHeaderresponse.getHeader(.);
                toHeader.setTag("4321");
                Address address = ..createAddress("Shootme <sip:"
                        +  + ":" +  + ">");
                ContactHeader contactHeader = .
                        .createContactHeader(address);
                response.addHeader(contactHeader);
                // Thread.sleep(5000);
                .info("got a server tranasaction " + st);
                byte[] content = request.getRawContent();
                if (content != null) {
                    ContentTypeHeader contentTypeHeader = .
                            .createContentTypeHeader("application""sdp");
                    response.setContent(contentcontentTypeHeader);
                }
                 = st.getDialog();
                if ( != null) {
                    .info("Dialog " + );
                    .info("Dialog state " + .getState());
                }
                st.sendResponse(response);
                response = ..createResponse(finalResponserequest);
                toHeader = (ToHeaderresponse.getHeader(.);
                toHeader.setTag("4321");
                // Application is supposed to set.
                response.addHeader(contactHeader);
                st.sendResponse(response);
                .info("TxState after sendResponse = " + st.getState());
                this. = st;
            } catch (Exception ex) {
                String s = "unexpected exception";
                .error(sex);
                ReInviteBusyTest.fail(s);
            }
        }
        public void sendReInvite(SipProvider sipProviderthrows Exception {
            Request inviteRequest = .createRequest(.);
            ((SipURIinviteRequest.getRequestURI()).removeParameter("transport");
            inviteRequest.addHeader(mf);
            ((ViaHeaderinviteRequest.getHeader(.))
                    .setTransport(.);
            Address address = ..createAddress("Shootme <sip:"
                    +  + ":" +  + ">");
            ContactHeader contactHeader = .
                    .createContactHeader(address);
            inviteRequest.addHeader(contactHeader);
            ClientTransaction ct = sipProvider.getNewClientTransaction(inviteRequest);
            .sendRequest(ct);
        }

        
Process the bye request.
        public void processBye(RequestEvent requestEventServerTransaction serverTransactionId) {
            SipProvider sipProvider = (SipProviderrequestEvent.getSource();
            Request request = requestEvent.getRequest();
            try {
                .info("shootme:  got a bye sending OK.");
                Response response = ..createResponse(200, request);
                if (serverTransactionId != null) {
                    serverTransactionId.sendResponse(response);
                    .info("Dialog State is " + serverTransactionId.getDialog().getState());
                } else {
                    .info("null server tx.");
                    // sipProvider.sendResponse(response);
                }
            } catch (Exception ex) {
                String s = "Unexpected exception";
                .error(sex);
                ReInviteBusyTest.fail(s);
            }
        }
        public void processResponse(ResponseEvent responseReceivedEvent) {
            .info("Got a response");
            Response response = (ResponseresponseReceivedEvent.getResponse();
            Transaction tid = responseReceivedEvent.getClientTransaction();
            .info("Response received with client transaction id " + tid + ":\n" + response);
            try {
                if (response.getStatusCode() == .
                        && ((CSeqHeaderresponse.getHeader(.)).getMethod().equals(
                                .)) {
                    this. = true;
                    ReInviteBusyTest.assertNotNull("INVITE 200 response should match a transaction",
                            tid);
                    Dialog dialog = tid.getDialog();
                    CSeqHeader cseq = (CSeqHeaderresponse.getHeader(.);
                    Request request = dialog.createAck(cseq.getSeqNumber());
                    dialog.sendAck(request);
                }
                if (tid != null) {
                    Dialog dialog = tid.getDialog();
                    .info("Dalog State = " + dialog.getState());
                }
            } catch (Exception ex) {
                String s = "Unexpected exception";
                .error(sex);
                ReInviteBusyTest.fail(s);
            }
        }
        public void processTimeout(javax.sip.TimeoutEvent timeoutEvent) {
            Transaction transaction;
            if (timeoutEvent.isServerTransaction()) {
                transaction = timeoutEvent.getServerTransaction();
            } else {
                transaction = timeoutEvent.getClientTransaction();
            }
            .info("state = " + transaction.getState());
            .info("dialog = " + transaction.getDialog());
            .info("dialogState = " + transaction.getDialog().getState());
            .info("Transaction Time out");
        }
        public SipProvider createSipProvider() throws Exception {
                    .);
            SipProvider sipProvider = ..createSipProvider(lp);
            return sipProvider;
        }
        public void checkState() {
            assertEquals("should see a re-INVITE", 2, this.);
          
        }
        /*
         * (non-Javadoc)
         * 
         * @see javax.sip.SipListener#processIOException(javax.sip.IOExceptionEvent)
         */
        public void processIOException(IOExceptionEvent exceptionEvent) {
            .error("An IO Exception was detected : " + exceptionEvent.getHost());
        }
        /*
         * (non-Javadoc)
         * 
         * @see javax.sip.SipListener#processTransactionTerminated(javax.sip.TransactionTerminatedEvent)
         */
        public void processTransactionTerminated(
                TransactionTerminatedEvent transactionTerminatedEvent) {
            .info("Tx terminated event ");
        }
        /*
         * (non-Javadoc)
         * 
         * @see javax.sip.SipListener#processDialogTerminated(javax.sip.DialogTerminatedEvent)
         */
        public void processDialogTerminated(DialogTerminatedEvent dialogTerminatedEvent) {
            .info("Dialog terminated event detected ");
            fail("shootme: Dialog TERMINATED event unexpected");
        }
    }
    class Shootist implements SipListener {
        private SipProvider provider;
        private int reInviteCount;
        private ContactHeader contactHeader;
        private ListeningPoint listeningPoint;
        // To run on two machines change these to suit.
        public static final String myAddress = "127.0.0.1";
        private static final int myPort = 5072;
        protected ClientTransaction inviteTid;
        private boolean okReceived;
        int reInviteReceivedCount;
        private ProtocolObjects protocolObjects;
        private Dialog dialog;
        private boolean busyHereReceived;
        public Shootist(ProtocolObjects protocolObjects) {
            super();
            this. = protocolObjects;
        }
       
        public void processRequest(RequestEvent requestReceivedEvent) {
            Request request = requestReceivedEvent.getRequest();
            ServerTransaction serverTransactionId = requestReceivedEvent.getServerTransaction();
            .info("\n\nRequest " + request.getMethod() + " received at "
                    + ..getStackName() + " with server transaction id "
                    + serverTransactionId);
            if (request.getMethod().equals(.))
                processInvite(requestserverTransactionId);
            else if (request.getMethod().equals(.))
                processAck(requestserverTransactionId);
        }
        public void processInvite(Request requestServerTransaction st) {
            try {
                this.++;
                Dialog dialog = st.getDialog();
                .info("shootist received RE INVITE. Sending BUSY_HERE");
                assertEquals("Dialog state must in confirmed state ",.,dialog.getState());
                Response response = ..createResponse(.,
                        request);
                ((ToHeaderresponse.getHeader(.)).setTag(((ToHeaderrequest
                        .getHeader(.)).getTag());
                Address address = ..createAddress("Shootme <sip:"
                        +  + ":" +  + ">");
                ContactHeader contactHeader = .
                        .createContactHeader(address);
                response.addHeader(contactHeader);
                st.sendResponse(response);
                assertEquals("Dialog state must be in confirmed state ",.,dialog.getState());
                ReInviteBusyTest.assertEquals("Dialog for reinvite must match original dialog",
                        dialogthis.);
            } catch (Exception ex) {
                .error("unexpected exception"ex);
                ReInviteBusyTest.fail("unexpected exception");
            }
        }
        public void processAck(Request requestServerTransaction tid) {
            try {
                .info("Got an ACK! ");
            } catch (Exception ex) {
                .error("unexpected exception"ex);
                ReInviteBusyTest.fail("unexpected exception");
            }
        }
        public void processResponse(ResponseEvent responseReceivedEvent) {
            .info("Got a response");
            Response response = (ResponseresponseReceivedEvent.getResponse();
            Transaction tid = responseReceivedEvent.getClientTransaction();
            .info("Response received with client transaction id " + tid + ":\n"
                    + response.getStatusCode());
            if (tid == null) {
                .info("Stray response -- dropping ");
                return;
            }
            .info("transaction state is " + tid.getState());
            .info("Dialog = " + tid.getDialog());
            .info("Dialog State is " + tid.getDialog().getState());
            SipProvider provider = (SipProviderresponseReceivedEvent.getSource();
            try {
                if (response.getStatusCode() == .
                        && ((CSeqHeaderresponse.getHeader(.)).getMethod().equals(
                                .)) {
                    // Request cancel = inviteTid.createCancel();
                    // ClientTransaction ct =
                    // sipProvider.getNewClientTransaction(cancel);
                    Dialog dialog = tid.getDialog();
                    CSeqHeader cseq = (CSeqHeaderresponse.getHeader(.);
                    Request ackRequest = dialog.createAck(cseq.getSeqNumber());
                    .info("Ack request to send = " + ackRequest);
                    .info("Sending ACK");
                    dialog.sendAck(ackRequest);
                    Thread.sleep(100);
                  
                    Request inviteRequest = dialog.createRequest(.);
                    ((SipURIinviteRequest.getRequestURI()).removeParameter("transport");
                    ((ViaHeaderinviteRequest.getHeader(.)).setTransport("udp");
                    inviteRequest.addHeader();
                    MaxForwardsHeader mf = .
                            .createMaxForwardsHeader(10);
                    inviteRequest.addHeader(mf);
                     ClientTransaction ct = provider.getNewClientTransaction(inviteRequest);
                    dialog.sendRequest(ct);
                    ++;
                    .info("RE-INVITE sent");
                } else if (response.getStatusCode() == .) {
                    this. = true;
                    TestCase.assertEquals("Dialog State must be CONFIRMED".getState(), .);
                }
            } catch (Exception ex) {
                ex.printStackTrace();
                .error(ex);
                ReInviteBusyTest.fail("unexpceted exception");
            }
        }
        public void processTimeout(javax.sip.TimeoutEvent timeoutEvent) {
            .info("Transaction Time out");
            .info("TimeoutEvent " + timeoutEvent.getTimeout());
        }
        public SipProvider createSipProvider() {
            try {
                        .);
                return ;
            } catch (Exception ex) {
                .error(ex);
                ReInviteBusyTest.fail("unable to create provider");
                return null;
            }
        }
        public void sendInvite() {
            try {
                // Note that a provider has multiple listening points.
                // all the listening points must have the same IP address
                // and port but differ in their transport parameters.
                String fromName = "BigGuy";
                String fromSipAddress = "here.com";
                String fromDisplayName = "The Master Blaster";
                String toSipAddress = "there.com";
                String toUser = "LittleGuy";
                String toDisplayName = "The Little Blister";
                // create >From Header
                SipURI fromAddress = ..createSipURI(fromName,
                        fromSipAddress);
                Address fromNameAddress = .
                        .createAddress(fromAddress);
                fromNameAddress.setDisplayName(fromDisplayName);
                FromHeader fromHeader = ..createFromHeader(
                        fromNameAddressnew Integer((int) (Math.random() * .))
                                .toString());
                // create To Header
                SipURI toAddress = ..createSipURI(toUser,
                        toSipAddress);
                Address toNameAddress = ..createAddress(toAddress);
                toNameAddress.setDisplayName(toDisplayName);
                ToHeader toHeader = ..createToHeader(toNameAddress,
                        null);
                // create Request URI
                SipURI requestURI = ..createSipURI(toUser,
                        );
                // Create ViaHeaders
                ArrayList viaHeaders = new ArrayList();
                int port = .getListeningPoint(.).getPort();
                ViaHeader viaHeader = ..createViaHeader(,
                        port.null);
                // add via headers
                viaHeaders.add(viaHeader);
                // Create ContentTypeHeader
                ContentTypeHeader contentTypeHeader = .
                        .createContentTypeHeader("application""sdp");
                // Create a new CallId header
                CallIdHeader callIdHeader = .getNewCallId();
                // JvB: Make sure that the implementation matches the messagefactory
                callIdHeader = ..createCallIdHeader(callIdHeader
                        .getCallId());
                // Create a new Cseq header
                CSeqHeader cSeqHeader = ..createCSeqHeader(1L,
                        .);
                // Create a new MaxForwardsHeader
                MaxForwardsHeader maxForwards = .
                        .createMaxForwardsHeader(70);
                // Create the request.
                Request request = ..createRequest(requestURI,
                        .callIdHeadercSeqHeaderfromHeadertoHeader,
                        viaHeadersmaxForwards);
                // Create contact headers
                // Create the contact name address.
                SipURI contactURI = ..createSipURI(fromName,
                        );
                contactURI.setPort(.getListeningPoint(.)
                        .getPort());
                Address contactAddress = ..createAddress(contactURI);
                // Add the contact address.
                contactAddress.setDisplayName(fromName);
                 = ..createContactHeader(contactAddress);
                request.addHeader();
                // Add the extension header.
                Header extensionHeader = ..createHeader("My-Header",
                        "my header value");
                request.addHeader(extensionHeader);
                String sdpData = "v=0\r\n" + "o=4855 13760799956958020 13760799956958020"
                        + " IN IP4  129.6.55.78\r\n" + "s=mysession session\r\n"
                        + "p=+46 8 52018010\r\n" + "c=IN IP4  129.6.55.78\r\n" + "t=0 0\r\n"
                        + "m=audio 6022 RTP/AVP 0 4 18\r\n" + "a=rtpmap:0 PCMU/8000\r\n"
                        + "a=rtpmap:4 G723/8000\r\n" + "a=rtpmap:18 G729A/8000\r\n"
                        + "a=ptime:20\r\n";
                request.setContent(sdpDatacontentTypeHeader);
                // The following is the preferred method to route requests
                // to the peer. Create a route header and set the "lr"
                // parameter for the router header.
                Address address = ..createAddress("<sip:"
                        +  + ":" +  + ">");
                // SipUri sipUri = (SipUri) address.getURI();
                // sipUri.setPort(PEER_PORT);
                RouteHeader routeHeader = .
                        .createRouteHeader(address);
                ((SipURIaddress.getURI()).setLrParam();
                request.addHeader(routeHeader);
                extensionHeader = ..createHeader("My-Other-Header",
                        "my new header value ");
                request.addHeader(extensionHeader);
                Header callInfoHeader = ..createHeader("Call-Info",
                        "<http://www.antd.nist.gov>");
                request.addHeader(callInfoHeader);
                // Create the client transaction.
                this. = .getNewClientTransaction(request);
                this. = this..getDialog();
                // Note that the response may have arrived right away so
                // we cannot check after the message is sent.
                ReInviteBusyTest.assertTrue(this..getState() == null);
                // send the request out.
                this..sendRequest();
            } catch (Exception ex) {
                .error("Unexpected exception"ex);
                ReInviteBusyTest.fail("unexpected exception");
            }
        }
        public void checkState() {
            ReInviteBusyTest.assertTrue("Expect to send a re-invite" == 1);
           // ReInviteBusyTest.assertTrue("Expecting a BUSY here", this.busyHereReceived);
        }
        /*
         * (non-Javadoc)
         * 
         * @see javax.sip.SipListener#processIOException(javax.sip.IOExceptionEvent)
         */
        public void processIOException(IOExceptionEvent exceptionEvent) {
            .error("IO Exception!");
            ReInviteBusyTest.fail("Unexpected exception");
        }
        /*
         * (non-Javadoc)
         * 
         * @see javax.sip.SipListener#processTransactionTerminated(javax.sip.TransactionTerminatedEvent)
         */
        public void processTransactionTerminated(
                TransactionTerminatedEvent transactionTerminatedEvent) {
            .info("Transaction Terminated Event!");
        }
        /*
         * (non-Javadoc)
         * 
         * @see javax.sip.SipListener#processDialogTerminated(javax.sip.DialogTerminatedEvent)
         */
        public void processDialogTerminated(DialogTerminatedEvent dialogTerminatedEvent) {
            .info("Dialog Terminated Event!");
            fail("shootist: unexpected event -- dialog terminated!");
        }
    }
    public ReInviteBusyTest() {
        super("reinvitetest");
    }
    public void setUp() {
        try {
            super.setUp();
            // String stackname, String pathname, String transport,
            // boolean autoDialog
            this. = new ProtocolObjects("shootist""gov.nist""udp"true,false);
             = new Shootist();
            SipProvider shootistProvider = .createSipProvider();
            this. = new ProtocolObjects("shootme""gov.nist""udp"true,false);
             = new Shootme();
            SipProvider shootmeProvider = .createSipProvider();
            
            shootistProvider.addSipListener();
            shootmeProvider.addSipListener();
            .start();
            .start();
            
        } catch (Exception ex) {
            ex.printStackTrace();
            fail("unexpected exception ");
        }
    }
    public void testSendInvite() {
        this..sendInvite();
    }
    public void tearDown() {
        try {
            Thread.sleep(4000);
            this..checkState();
            this..checkState();
            .destroy();
            .destroy();
            Thread.sleep(1000);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }