Class SslBrokerService

  • All Implemented Interfaces:
    Service

    public class SslBrokerService
    extends BrokerService
    A BrokerService that allows access to the key and trust managers used by SSL connections. There is no reason to use this class unless SSL is being used AND the key and trust managers need to be specified from within code. In fact, if the URI passed to this class does not have an "ssl" scheme, this class will pass all work on to its superclass.
    Author:
    sepandm@gmail.com (Sepand)
    • Constructor Detail

      • SslBrokerService

        public SslBrokerService()
    • Method Detail

      • addSslConnector

        public TransportConnector addSslConnector​(String bindAddress,
                                                  KeyManager[] km,
                                                  TrustManager[] tm,
                                                  SecureRandom random)
                                           throws Exception
        Adds a new transport connector for the given bind address. If the transport created uses SSL, it will also use the key and trust managers provided. Otherwise, this is the same as calling addConnector.
        Parameters:
        bindAddress - The address to bind to.
        km - The KeyManager to be used.
        tm - The trustmanager to be used.
        random - The source of randomness for the generator.
        Returns:
        the newly connected and added transport connector.
        Throws:
        Exception
      • addSslConnector

        public TransportConnector addSslConnector​(URI bindAddress,
                                                  KeyManager[] km,
                                                  TrustManager[] tm,
                                                  SecureRandom random)
                                           throws Exception
        Adds a new transport connector for the given bind address. If the transport created uses SSL, it will also use the key and trust managers provided. Otherwise, this is the same as calling addConnector.
        Parameters:
        bindAddress - The URI to bind to.
        km - The KeyManager to be used.
        tm - The trustmanager to be used.
        random - The source of randomness for the generator.
        Returns:
        the newly created and added transport connector.
        Throws:
        Exception
      • createSslTransportServer

        protected TransportServer createSslTransportServer​(URI brokerURI,
                                                           KeyManager[] km,
                                                           TrustManager[] tm,
                                                           SecureRandom random)
                                                    throws IOException,
                                                           KeyManagementException
        Creates a TransportServer that uses the given key and trust managers. The last three parameters will be eventually passed to SSLContext.init.
        Parameters:
        brokerURI - The URI to bind to.
        km - The KeyManager to be used.
        tm - The trustmanager to be used.
        random - The source of randomness for the generator.
        Returns:
        A new TransportServer that uses the given managers.
        Throws:
        IOException - If cannot handle URI.
        KeyManagementException - Passed on from SSL.