@Test
	public void testResponses() {
		JsonRpcResponse resSent = JsonRpcResponse.newStartSdpResponse("MySdp",
				"MySessionId", 9);
		String json = GsonUtils.getGson().toJson(resSent);
		JsonRpcResponse resReceived = GsonUtils.getGson().fromJson(json,
				JsonRpcResponse.class);

		assertTrue(resReceived.getResponseResult().getSdp().equals("MySdp"));

		if (!resSent.toString().equals(resReceived.toString())) {
			fail("Start responses do not match");
		}

		resSent = JsonRpcResponse
				.newStartUrlResponse("MyUrl", "MySessionId", 9);
		json = GsonUtils.getGson().toJson(resSent);
		resReceived = GsonUtils.getGson().fromJson(json, JsonRpcResponse.class);

		assertTrue(resReceived.getResponseResult().getUrl().equals("MyUrl"));

		if (!resSent.toString().equals(resReceived.toString())) {
			fail("Start responses do not match");
		}

		resSent = JsonRpcResponse.newStartRejectedResponse(2345,
				"MyRejectedMessage", 9);
		json = GsonUtils.getGson().toJson(resSent);
		resReceived = GsonUtils.getGson().fromJson(json, JsonRpcResponse.class);

		assertTrue(resReceived.getResponseResult().getRejected().getMessage()
				.equals("MyRejectedMessage"));

		if (!resSent.toString().equals(resReceived.toString())) {
			fail("Start responses do not match");
		}

		resSent = JsonRpcResponse.newExecuteResponse("MyComandResult", 9);
		json = GsonUtils.getGson().toJson(resSent);
		resReceived = GsonUtils.getGson().fromJson(json, JsonRpcResponse.class);

		assertTrue(resReceived.getResponseResult().getCommandResult()
				.equals("MyComandResult"));

		if (!resSent.toString().equals(resReceived.toString())) {
			fail("Execute responses do not match");
		}

		resSent = JsonRpcResponse.newError(2345, "MyErrorMessage",
				"MyErrorData", 9);
		json = GsonUtils.getGson().toJson(resSent);
		resReceived = GsonUtils.getGson().fromJson(json, JsonRpcResponse.class);

		assertTrue(resReceived.isError());
		assertTrue(resReceived.getResponseError().getCode() == 2345);

		if (!resSent.toString().equals(resReceived.toString())) {
			fail("Error responses do not match");
		}

		resSent = JsonRpcResponse.newPollResponse(null, null, 9);
		json = GsonUtils.getGson().toJson(resSent);
		resReceived = GsonUtils.getGson().fromJson(json, JsonRpcResponse.class);

		if (!resSent.toString().equals(resReceived.toString())) {
			fail("Poll responses do not match");
		}

		JsonRpcContentEvent[] contentEvents = new JsonRpcContentEvent[10];
		for (int i = 0; i < 10; i++) {
			contentEvents[i] = new JsonRpcContentEvent("MyType" + i, "MyData"
					+ i);
		}

		JsonRpcControlEvent[] controlEvents = new JsonRpcControlEvent[10];
		for (int i = 0; i < 10; i++) {
			controlEvents[i] = new JsonRpcControlEvent("MyType" + i,
					new JsonRpcReason(34, "MyMessage" + i));
		}

		resSent = JsonRpcResponse.newPollResponse(contentEvents, controlEvents,
				9);
		json = GsonUtils.getGson().toJson(resSent);
		resReceived = GsonUtils.getGson().fromJson(json, JsonRpcResponse.class);

		assertTrue(!resReceived.isError());
		assertTrue(resReceived.getResponseResult().getControlEvents()[0]
				.getType().equals("MyType0"));

		if (!resSent.toString().equals(resReceived.toString())) {
			fail("Poll responses do not match");
		}
	}