Example usage for org.springframework.amqp.rabbit.connection RabbitConnectionFactoryBean setUpSSL

List of usage examples for org.springframework.amqp.rabbit.connection RabbitConnectionFactoryBean setUpSSL

Introduction

In this page you can find the example usage for org.springframework.amqp.rabbit.connection RabbitConnectionFactoryBean setUpSSL.

Prototype

protected void setUpSSL() 

Source Link

Document

Override this method to take complete control over the SSL setup.

Usage

From source file:org.springframework.amqp.rabbit.connection.SSLConnectionTests.java

@Test
public void testTypeProps() throws Exception {
    RabbitConnectionFactoryBean fb = new RabbitConnectionFactoryBean();
    fb.setSslPropertiesLocation(new ClassPathResource("ssl.properties"));
    fb.afterPropertiesSet();//from ww  w  .  java2s.c  o m
    try {
        fb.setUpSSL();
        //Here we make sure the exception is thrown because setUpSSL() will fail.
        // But we only care about having it load the props
        fail("setupSSL should fail");
    } catch (Exception e) {
        assertEquals("foo", fb.getKeyStoreType());
        assertEquals("bar", fb.getTrustStoreType());
    }
}

From source file:org.springframework.amqp.rabbit.connection.SSLConnectionTests.java

@Test
public void testTypeSettersOverrideProps() throws Exception {
    RabbitConnectionFactoryBean fb = new RabbitConnectionFactoryBean();
    fb.setSslPropertiesLocation(new ClassPathResource("ssl.properties"));
    fb.afterPropertiesSet();/*from   w  w  w  . j  ava 2 s  . c  o m*/
    fb.setKeyStoreType("alice");
    fb.setTrustStoreType("bob");
    try {
        fb.setUpSSL();
        // Here we make sure the exception is thrown because setUpSSL() will fail.
        //But we only care about having it load the props
        fail("setupSSL should fail");
    } catch (Exception e) {
        assertEquals("alice", fb.getKeyStoreType());
        assertEquals("bob", fb.getTrustStoreType());
    }
}