Package org.cafesip.sipunit

Examples of org.cafesip.sipunit.PublishSession.sendRequest()


   */
  public void testSubscription3() throws Exception
  {
    PublishSession publishSession = new PublishSession(getBobPhone());
        Request publish = publishSession.newPublish(getClass().getResourceAsStream("publish1.xml"), 60); // 1
        publishSession.sendRequest(publish, SipResponse.OK); // 2
   
    SubscribeSession presenceSession = new SubscribeSession(getAlicePhone(), "presence");
    Request subscribe = presenceSession.newInitialSubscribe(100, getBobUri()); // 3
    presenceSession.sendRequest(subscribe, Response.OK); // 4

View Full Code Here


       
    tx = presenceSession.waitForNotify(); // 23
    presenceSession.sendResponse(Response.OK, tx); // 24
   
    publish = publishSession.newUnpublish(); // 25
    publishSession.sendRequest(publish, Response.OK); // 26
  }
 
  /**
   * <pre>
       Bob                Kaleo                 Alice
View Full Code Here

   */
  public void testWaitingState() throws Exception
  {
    PublishSession publishSession = new PublishSession(getAlicePhone());
        Request publish = publishSession.newPublish(getClass().getResourceAsStream("publish1.xml"), 60); // 1
        publishSession.sendRequest(publish, SipResponse.OK); // 2
       
        SubscribeSession presenceSession = new SubscribeSession(getBobPhone(), "presence");
    Request subscribe = presenceSession.newInitialSubscribe(0, getAliceUri()); // 3
    presenceSession.sendRequest(subscribe, Response.OK); // 4

View Full Code Here

    presenceSession.sendResponse(Response.OK, tx); // 16
    presence = getPresence(tx.getRequest());
    assertEquals(Basic.OPEN, presence.getTupleArray()[0].getStatus().getBasic());
   
    publish = publishSession.newUnpublish(); // 25
    publishSession.sendRequest(publish, Response.OK); // 26
  }
   
  private Watcherinfo getWatcherinfo(Request request)
  {
    ContentTypeHeader contentType = (ContentTypeHeader) request.getHeader(ContentTypeHeader.NAME);
View Full Code Here

       
        Thread.sleep(200);
       
        PublishSession publishSession = new PublishSession(getBobPhone());
        Request publish = publishSession.newPublish(getClass().getResourceAsStream("publish1.xml"), 20);
        publishSession.sendRequest(publish, SipResponse.OK);

        // get the NOTIFY
        reqevent = s.waitNotify(10000);
        assertNotNull(s.format(), reqevent);
        assertNoSubscriptionErrors(s);
View Full Code Here

        assertTrue(s.replyToNotify(reqevent, response));
       
        assertTrue(s.isSubscriptionTerminated())
       
    publish = publishSession.newUnpublish(); // 13
    publishSession.sendRequest(publish, Response.OK); // 14
    }

    public void testMinExpires() throws Exception
    {      
        SubscribeSession session = new SubscribeSession(getAlicePhone(), "presence");
View Full Code Here

   
    public void testEtags() throws Exception
    {      
       PublishSession publishSession = new PublishSession(getBobPhone());
         Request publish = publishSession.newPublish(getClass().getResourceAsStream("publish1.xml"), 20);
         Response response = publishSession.sendRequest(publish, SipResponse.OK);
        
         SIPETagHeader etagHeader = (SIPETagHeader) response.getHeader(SIPETagHeader.NAME);
         assertNotNull(etagHeader);
         String etag = etagHeader.getETag();
        
View Full Code Here

         String etag = etagHeader.getETag();
        
         publish = publishSession.newPublish(getClass().getResourceAsStream("publish2.xml"), 20);
         HeaderFactory hf = publishSession.getHeaderFactory();
         publish.setHeader(hf.createSIPIfMatchHeader(etag));
         response = publishSession.sendRequest(publish, SipResponse.OK);
         etagHeader = (SIPETagHeader) response.getHeader(SIPETagHeader.NAME);
         assertNotNull(etagHeader);
        
         publish = publishSession.newPublish(getClass().getResourceAsStream("publish1.xml"), 20);
         publish.setHeader(hf.createSIPIfMatchHeader(etag)); //Use old etag
View Full Code Here

         etagHeader = (SIPETagHeader) response.getHeader(SIPETagHeader.NAME);
         assertNotNull(etagHeader);
        
         publish = publishSession.newPublish(getClass().getResourceAsStream("publish1.xml"), 20);
         publish.setHeader(hf.createSIPIfMatchHeader(etag)); //Use old etag
         response = publishSession.sendRequest(publish, SipServletResponse.SC_CONDITIONAL_REQUEST_FAILED);
        
         publish = publishSession.newUnpublish(); // 25
      publishSession.sendRequest(publish, Response.OK); // 26
    }
View Full Code Here

         publish = publishSession.newPublish(getClass().getResourceAsStream("publish1.xml"), 20);
         publish.setHeader(hf.createSIPIfMatchHeader(etag)); //Use old etag
         response = publishSession.sendRequest(publish, SipServletResponse.SC_CONDITIONAL_REQUEST_FAILED);
        
         publish = publishSession.newUnpublish(); // 25
      publishSession.sendRequest(publish, Response.OK); // 26
    }

}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.