@Test
public void testFilteringOfSslProperties() throws Exception {

	// No value for the "pass.as.user.data"
	Map<String,String> configuration = new HashMap<> ();
	configuration.put( RABBITMQ_SERVER_IP, "localhost" );
	configuration.put( RABBITMQ_SERVER_USERNAME, "guest" );
	configuration.put( RABBITMQ_SERVER_PASSWORD, "guest" );
	configuration.put( RABBITMQ_SSL_KEY_STORE_PASSPHRASE, "1" );
	configuration.put( RABBITMQ_SSL_KEY_STORE_TYPE, "2" );
	configuration.put( RABBITMQ_SSL_KEY_STORE_PATH, "3" );
	configuration.put( RABBITMQ_SSL_KEY_MNGR_FACTORY, "4" );
	configuration.put( RABBITMQ_SSL_TRUST_MNGR_FACTORY, "5" );
	configuration.put( RABBITMQ_SSL_TRUST_STORE_PASSPHRASE, "6" );
	configuration.put( RABBITMQ_SSL_TRUST_STORE_PATH, "7" );
	configuration.put( RABBITMQ_SSL_TRUST_STORE_TYPE, "8" );
	configuration.put( RABBITMQ_SSL_PROTOCOL, "9" );
	configuration.put( RABBITMQ_USE_SSL, "true" );
	final int beforeCpt = configuration.size();
	// Remember we add the messaging type as a new property.
	// We also set the value for "pass.as.user.data".
	RabbitMqClient client = new RabbitMqClient( null, configuration, RecipientKind.DM );
	Map<String,String> retrievedConfiguration = client.getConfiguration();
	Assert.assertEquals( beforeCpt + 4, retrievedConfiguration.size());
	Assert.assertEquals( "", retrievedConfiguration.get( UserDataHelpers.ENCODE_FILE_CONTENT_PREFIX + RABBITMQ_SSL_KEY_STORE_PATH ));
	Assert.assertEquals( "", retrievedConfiguration.get( UserDataHelpers.ENCODE_FILE_CONTENT_PREFIX + RABBITMQ_SSL_TRUST_STORE_PATH ));
	// "pass.as.user.data" is true => same behavior
	configuration.put( RABBITMQ_SSL_AS_USER_DATA, "true" );
	client = new RabbitMqClient( null, configuration, RecipientKind.DM );
	retrievedConfiguration = client.getConfiguration();
	Assert.assertEquals( beforeCpt + 4, retrievedConfiguration.size());
	Assert.assertEquals( "", retrievedConfiguration.get( UserDataHelpers.ENCODE_FILE_CONTENT_PREFIX + RABBITMQ_SSL_KEY_STORE_PATH ));
	Assert.assertEquals( "", retrievedConfiguration.get( UserDataHelpers.ENCODE_FILE_CONTENT_PREFIX + RABBITMQ_SSL_TRUST_STORE_PATH ));
	// "pass.as.user.data" is false => only the SSL protocol is kept
	configuration.put( RABBITMQ_SSL_AS_USER_DATA, "false" );
	client = new RabbitMqClient( null, configuration, RecipientKind.DM );
	retrievedConfiguration = client.getConfiguration();
	Assert.assertEquals( 7, retrievedConfiguration.size());
	Assert.assertEquals( "localhost", retrievedConfiguration.get( RABBITMQ_SERVER_IP ));
	Assert.assertEquals( "guest", retrievedConfiguration.get( RABBITMQ_SERVER_USERNAME ));
	Assert.assertEquals( "guest", retrievedConfiguration.get( RABBITMQ_SERVER_PASSWORD ));
	Assert.assertEquals( "9", retrievedConfiguration.get( RABBITMQ_SSL_PROTOCOL ));
	Assert.assertEquals( FACTORY_RABBITMQ, retrievedConfiguration.get( MessagingConstants.MESSAGING_TYPE_PROPERTY ));
	Assert.assertEquals( "false", retrievedConfiguration.get( RABBITMQ_SSL_AS_USER_DATA ));
	Assert.assertEquals( "true", retrievedConfiguration.get( RABBITMQ_USE_SSL ));
	// "pass.as.user.data" has an invalid value => same as "true"
	configuration.put( RABBITMQ_SSL_AS_USER_DATA, "oops" );
	client = new RabbitMqClient( null, configuration, RecipientKind.DM );
	retrievedConfiguration = client.getConfiguration();
	Assert.assertEquals( beforeCpt + 4, retrievedConfiguration.size());
	Assert.assertEquals( "true", retrievedConfiguration.get( RABBITMQ_SSL_AS_USER_DATA ));
	Assert.assertEquals( "", retrievedConfiguration.get( UserDataHelpers.ENCODE_FILE_CONTENT_PREFIX + RABBITMQ_SSL_KEY_STORE_PATH ));
	Assert.assertEquals( "", retrievedConfiguration.get( UserDataHelpers.ENCODE_FILE_CONTENT_PREFIX + RABBITMQ_SSL_TRUST_STORE_PATH ));
	// Disable SSL
	configuration.put( RABBITMQ_USE_SSL, "false" );
	client = new RabbitMqClient( null, configuration, RecipientKind.DM );
	retrievedConfiguration = client.getConfiguration();
	Assert.assertEquals( 4, retrievedConfiguration.size());
	Assert.assertEquals( "localhost", retrievedConfiguration.get( RABBITMQ_SERVER_IP ));
	Assert.assertEquals( "guest", retrievedConfiguration.get( RABBITMQ_SERVER_USERNAME ));
	Assert.assertEquals( "guest", retrievedConfiguration.get( RABBITMQ_SERVER_PASSWORD ));
	Assert.assertEquals( FACTORY_RABBITMQ, retrievedConfiguration.get( MessagingConstants.MESSAGING_TYPE_PROPERTY ));
	// Disable SSL
	configuration.remove( RABBITMQ_USE_SSL );
	client = new RabbitMqClient( null, configuration, RecipientKind.DM );
	retrievedConfiguration = client.getConfiguration();
	Assert.assertEquals( 4, retrievedConfiguration.size());
	Assert.assertEquals( "localhost", retrievedConfiguration.get( RABBITMQ_SERVER_IP ));
	Assert.assertEquals( "guest", retrievedConfiguration.get( RABBITMQ_SERVER_USERNAME ));
	Assert.assertEquals( "guest", retrievedConfiguration.get( RABBITMQ_SERVER_PASSWORD ));
	Assert.assertEquals( FACTORY_RABBITMQ, retrievedConfiguration.get( MessagingConstants.MESSAGING_TYPE_PROPERTY ));
}