@Test
	public void testMulticastListener() throws InstantiationException, IllegalAccessException, ClassNotFoundException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
		ISSDPNetwork instance = SSDPNetworkFactory.getInstance();
		
		assertNotNull(instance);
		
		final String msg = "testMulticastListener";
		
		final CountDownLatch latch1 = new CountDownLatch(1);
		final CountDownLatch latch2 = new CountDownLatch(1);
		
		InetAddress group = null;
		
		Thread t1 = null;
		Thread t2 = null;
		
		try {
			
			group = InetAddress.getByName(SSDPContants.DEFAULT_IP);
			
			final IMulticastListener listener1 = instance.createMulticastListener(SSDPContants.DEFAULT_PORT, new ISSDPResponseHandler() {
				
				@Override
				public void setSSDPControler(ISSDPControler controler) {
				}
				
				@Override
				public void handle(String message) throws Exception {
					
				}
				
				@Override
				public void handle(String remoteAddr, int remotePort, String message)
						throws Exception {
					if(msg.equals(message)){
						latch1.countDown();
					}
					
				}
				
				@Override
				public ISSDPControler getSSDPControler() {
					return null;
				}
			});
			assertNotNull(listener1);
			
			final IMulticastListener listener2 = instance.createMulticastListener(new InetSocketAddress(SSDPContants.DEFAULT_PORT+1), new ISSDPResponseHandler() {
				
				@Override
				public void setSSDPControler(ISSDPControler controler) {
				}
				
				@Override
				public void handle(String message) throws Exception {
					
				}
				
				@Override
				public void handle(String remoteAddr, int remotePort, String message)
						throws Exception {
					if(msg.equals(message)){
						latch2.countDown();
					}
				}
				
				@Override
				public ISSDPControler getSSDPControler() {
					return null;
				}
			});
			assertNotNull(listener2);
			
			
			listener1.joinGroup(group);
			listener2.joinGroup(group);
			
			t1 = new Thread(new Runnable(){
				@Override
				public void run() {
					while(!Thread.interrupted()){
						try {
							listener1.receive(false);
						} catch (Exception e) {
							e.printStackTrace();
						}
					}
					
				}});
			
			t2 = new Thread(new Runnable(){
				@Override
				public void run() {
					while(!Thread.interrupted()){
						try {
							listener2.receive(false);
						} catch (Exception e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						}
					}
					
				}});
			
			t1.start();
			t2.start();
			
		} catch(Exception e){
			e.printStackTrace();
			fail("Shouldn't throw Exception");
		}
		
		try {
			IUDPSender sender2 = instance.createUDPSender();
			assertNotNull(sender2);
			
			sender2.sendMessage(msg, InetAddress.getByName(SSDPContants.DEFAULT_IP), SSDPContants.DEFAULT_PORT, new SSDPDefaultResponseHandler(null) {}, 5);
			sender2.sendMessage(msg, InetAddress.getByName(SSDPContants.DEFAULT_IP), SSDPContants.DEFAULT_PORT+1, null, 5);

			
		} catch(Exception e){
			e.printStackTrace();
			fail("Shouldn't throw Exception");
		}
		
		try {
			latch1.await(4, TimeUnit.SECONDS);
		} catch (InterruptedException e) {
		}
		
		t1.interrupt();
		t2.interrupt();
		
		assertEquals(0, latch1.getCount());
		assertEquals(0, latch2.getCount());
		
	}