ok.setHeader(createRiContact());
	public void testClientDialogStates() {		try {			Request invite = createTiInviteRequest(null, null, null);			ClientTransaction tran = null;			//Send an invite request			try {				eventCollector.collectRequestEvent(riSipProvider);				tran = tiSipProvider.getNewClientTransaction(invite);				tran.sendRequest();			} catch (TooManyListenersException e) {				throw new TckInternalError(					"Failed to register a listener with the RI",					e);			} catch (SipException e) {				throw new TiUnexpectedError(					"Failed to send initial invite request",					e);			}			//Wait for the invite to arrive			waitForMessage();			RequestEvent inviteReqEvt =				eventCollector.extractCollectedRequestEvent();			if (inviteReqEvt == null || inviteReqEvt.getRequest() == null)				throw new TiUnexpectedError("The TI did not send the initial invite request");			//get the dialog			Dialog dialog = tran.getDialog();			//We should have a null state here			assertNull(				"A dialog passed into the "					+ dialog.getState()					+ " state before recieving any response!",				dialog.getState());			//We will now send RINGING response and see that the Dialog enters an early state			//start listening for the response			try {				eventCollector.collectResponseEvent(tiSipProvider);			} catch (TooManyListenersException e) {				throw new TiUnexpectedError(					"Failed to register a SipListener with the TI.",					e);			}			Response ringing = null;			try {				ringing =					riMessageFactory.createResponse(						Response.RINGING,						inviteReqEvt.getRequest());				((ToHeader) ringing.getHeader(ToHeader.NAME)).setTag(					Integer.toString(hashCode()));				riSipProvider.sendResponse(ringing);			} catch (Exception e) {				throw new TckInternalError(					"Failed to create and send a RINGING response",					e);			}			waitForMessage();			ResponseEvent ringingRespEvt =				eventCollector.extractCollectedResponseEvent();			if (ringingRespEvt == null || ringingRespEvt.getResponse() == null)				throw new TiUnexpectedError("The TI did not pass RINGING response to the TU.");			//The dialog should now be in its early state.			assertEquals(				"The Dialog did not pass into the early state upon reception of a RINGING response",				DialogState.EARLY,				dialog.getState());			//We will now send OK response and see that the Dialog enters a CONFIRMED state			//start listening for the response			try {				eventCollector.collectResponseEvent(tiSipProvider);			} catch (TooManyListenersException e) {				throw new TiUnexpectedError(					"Failed to register a SipListener with the TI.",					e);			}			Response ok = null;			try {				ok =					riMessageFactory.createResponse(						Response.OK,						inviteReqEvt.getRequest());				((ToHeader) ok.getHeader(ToHeader.NAME)).setTag(					Integer.toString(hashCode()));				riSipProvider.sendResponse(ok);			} catch (Exception e) {				throw new TckInternalError(					"Failed to create and send a OK response",					e);			}			waitForMessage();			ResponseEvent okRespEvt =				eventCollector.extractCollectedResponseEvent();			if (okRespEvt == null || okRespEvt.getResponse() == null)				throw new TiUnexpectedError("The TI did not pass OK response to the TU.");			//The dialog should now be in its confirmed state.			assertEquals(				"The Dialog did not pass into the CONFIRMED state upon reception of an OK response",				DialogState.CONFIRMED,				dialog.getState());			//Say bye and go COMPLETED			try {				Request bye = dialog.createRequest(Request.BYE);				ClientTransaction byeTran =					tiSipProvider.getNewClientTransaction(bye);				dialog.sendRequest(byeTran);			} catch (SipException e) {				throw new TiUnexpectedError(					"Failed to create and send a BYE request using a dialog.",					e);			}			assertTrue(				"The dialog did not pass into a final (COMPLETED or TERMINATED) state after sending a BYE.",				DialogState.COMPLETED.equals(dialog.getState())					|| DialogState.TERMINATED.equals(dialog.getState()));		} catch (Throwable exc) {			exc.printStackTrace();			fail(exc.getClass().getName() + ": " + exc.getMessage());		}		assertTrue(new Exception().getStackTrace()[0].toString(), true);	}