Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package test.unit.gov.nist.javax.sip.stack.dialog.termination;
  
  
 
 
 import  test.tck.msgflow.callflows.ScenarioHarness;
 
 public class DialogTerminationOn50XTest extends ScenarioHarness implements SipListener {
 
     protected Shootist shootist;
 
     private Shootme shootme;
 
     private static Logger logger = Logger.getLogger("test.tck");
 
     static {
         if (!.isAttached(console))
             .addAppender(console);
     }
 
     private SipListener getSipListener(EventObject sipEvent) {
         SipProvider source = (SipProvidersipEvent.getSource();
         SipListener listener = (SipListener) providerTable.get(source);
         assertTrue(listener != null);
         return listener;
     }
 
     public DialogTerminationOn50XTest() {
         super("DialogTerminationOn500Test"true);
 
     }
 
     public void setUp() {
         doSetUp();
 
     }
 
     private void doSetUp() {
         try {
             this. = "udp";
 
             super.setUp();
              = new Shootist(getRiProtocolObjects());
             SipProvider shootistProvider = .createSipProvider();
             .init();
             providerTable.put(shootistProvider);
 
              = new Shootme(getTiProtocolObjects());
             SipProvider shootmeProvider = .createSipProvider();
             .init();
             providerTable.put(shootmeProvider);
             shootistProvider.addSipListener(this);
             shootmeProvider.addSipListener(this);
 
             getRiProtocolObjects().start();
             if (getTiProtocolObjects() != getRiProtocolObjects())
                 getTiProtocolObjects().start();
         } catch (Exception ex) {
             ex.printStackTrace();
             fail("unexpected exception ");
         }
     }
 
     public void testSendInviteShouldNotTerminatedOnINFO() {
         for (int i = 300; i < 601; i += 100 ) {
             try {
 
                 this..setResponseCodeToINFO(i);
                 this..setResponseCodeToINFO(i);
                 this..sendInviteRequest();
                 Thread.currentThread().sleep(25000);
             } catch (InterruptedException e) {
                 // TODO Auto-generated catch block
                 e.printStackTrace();
             }
 
             if (!this..checkState() || !this..checkState()) {
                 fail("Test Failed - Didnt receive DTE for response: "+i);
                 return;
             }
             if (i != 600) {
                 doTearDown(false);
                 doSetUp();
             }
 
         }
 
     }
 
    public void tearDown() {
        doTearDown(true);
    }
    private void doTearDown(boolean definetly) {
        try {
            Thread.sleep(2000);
            // this.shootist.checkState();
            // this.shootme.checkState();
            getTiProtocolObjects().destroy();
            if (getTiProtocolObjects() != getRiProtocolObjects())
                getRiProtocolObjects().destroy();
            Thread.sleep(1000);
            this..clear();
            if (definetly)
                logTestCompleted();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
    public void processRequest(RequestEvent requestEvent) {
        getSipListener(requestEvent).processRequest(requestEvent);
    }
    public void processResponse(ResponseEvent responseEvent) {
        getSipListener(responseEvent).processResponse(responseEvent);
    }
    public void processTimeout(TimeoutEvent timeoutEvent) {
        getSipListener(timeoutEvent).processTimeout(timeoutEvent);
    }
    public void processIOException(IOExceptionEvent exceptionEvent) {
        fail("unexpected exception");
    }
    public void processTransactionTerminated(TransactionTerminatedEvent transactionTerminatedEvent) {
        getSipListener(transactionTerminatedEvent).processTransactionTerminated(transactionTerminatedEvent);
    }
    public void processDialogTerminated(DialogTerminatedEvent dialogTerminatedEvent) {
        getSipListener(dialogTerminatedEvent).processDialogTerminated(dialogTerminatedEvent);
    }
New to GrepCode? Check out our FAQ X