Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  
  package examples.forked.invite;
  
  
 
 
 
 import  junit.framework.TestCase;

Author(s):
M. Ranganathan
 
 public class ForkedInviteTest extends TestCase implements SipListener {
 
     private Hashtable providerTable;
 
     protected Shootist shootist;
 
     private static Logger logger = Logger.getLogger(ForkedInviteTest.class);
 
     static {
         if (.getAllAppenders() instanceof NullEnumeration )
             PropertyConfigurator.configure("log4j.properties");
 
 
 
     }
 
     //private Appender appender;
 
     private SipListener getSipListener(EventObject sipEvent) {
         SipProvider source = (SipProvidersipEvent.getSource();
         SipListener listener = (SipListener.get(source);
         assertTrue(listener != null);
         return listener;
     }
 
     public ForkedInviteTest() {
 
         try {
             . = "logs/";
             ProtocolObjects.init("frokedinvite",true);
              = new Hashtable();
              = new Shootist();
             SipProvider shootistProvider = .createSipProvider();
             .put(shootistProvider);
 
             Shootme shootme = new Shootme(5080);
             SipProvider shootmeProvider = shootme.createProvider();
             .put(shootmeProvidershootme);
             shootistProvider.addSipListener(this);
             shootmeProvider.addSipListener(this);
 
             shootme = new Shootme(5090);
             shootmeProvider = shootme.createProvider();
             .put(shootmeProvidershootme);
             shootistProvider.addSipListener(this);
             shootmeProvider.addSipListener(this);
 
 
             Proxy proxy = new Proxy();
             SipProvider provider = proxy.createSipProvider();
             provider.setAutomaticDialogSupportEnabled(false);
             .put(providerproxy);
             provider.addSipListener(this);
 
 
             ProtocolObjects.start();
         } catch (Exception ex) {
             fail("unexpected exception ");
         }
     }
 
     public void testSendForkedInvite() {
         try {
         this..sendInvite();
        Thread.sleep(20000);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
    public void setUp() {
            try {
                //Runtime.getRuntime().exec("java examples.forked.invite.Proxy");
            } catch (Exception ex) {
                throw new RuntimeException("Unexpected error initializing logging",
                        ex);
            }
    }
    public void tearDown() {
        try {
            ProtocolObjects.destroy();
            //logger.removeAppender(appender);
        } 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