	@Test
	public void testRestorePacketForOffLineUser() throws Exception {

		BareJID userJid = BareJID.bareJIDInstance("user1@example.com");
		JID res1 = JID.jidInstance(userJid, "res1");
		XMPPResourceConnection session1 = getSession(JID.jidInstance("c2s@example.com/" + UUID.randomUUID().toString()), res1);

		assertEquals(Arrays.asList(session1), session1.getActiveSessions());

		Element packetEl = new Element("iq", new String[] { "type", "from", "to", "time" },
				new String[] { "set", "dip1@test.com/res1", userJid.toString(), "1440810935000" });
		packetEl.addChild(new Element("jingle", new String[] { "action", "sid", "offline", "xmlns" },
				new String[] { "session-terminate", UUID.randomUUID().toString(), "true", "urn:xmpp:jingle:1" }));
		Packet packet = Packet.packetInstance(packetEl);
		msgRepo.storeMessage( packet.getFrom(), packet.getTo(), null, packet.getElement(), null);

		packetEl = new Element("iq", new String[] { "type", "from", "to", "time" },
				new String[] { "set", "dip1@test.com/res1", userJid.toString(), "1440810972000" });
		packetEl.addChild(new Element("jingle", new String[] { "action", "sid", "offline", "xmlns" },
				new String[] { "session-terminate", UUID.randomUUID().toString(), "true", "urn:xmpp:jingle:1" }));
		packet = Packet.packetInstance(packetEl);
		msgRepo.storeMessage( packet.getFrom(), packet.getTo(), null, packet.getElement(), null);

		assertTrue("no message stored, while it should be stored", !msgRepo.getStored().isEmpty());

		Queue<Packet> restorePacketForOffLineUser = offlineProcessor.restorePacketForOffLineUser( session1, msgRepo );

		assertEquals("number of restored messages differ!", restorePacketForOffLineUser.size(), 2);

		msgRepo.getStored().clear();
	}