be secured transparently without extra coding effort. To secure your messaging application with SSL, you need to configure connector and acceptor as follows:</p>
<p>In the configuration, the hornetq.example.keystore is the key store file holding the server's certificate. The hornetq.example.truststore
is the file holding the certificates which the client trusts (i.e. the server's certificate exported from hornetq.example.keystore). They are pre-generated for illustration purpose<aid="fnr1"href="readme.html#fn1"><sup>1</sup></a>.</p>
<h2>Example step-by-step</h2>
<p><i>To run the example, simply type <code>mvn verify</code> from this directory</i></p>
<ol>
<li>First we need to get an initial context so we can look-up the JMS connection factory and destination objects from JNDI. This initial context will get it's properties from the <code>client-jndi.properties</code> file in the directory <code>../common/config</code></li>
<li>And finally, <b>always</b> remember to close your JMS connections and resources after use, in a <code>finally</code> block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objects</li>
<preclass="prettyprint">
<code>finally
{
if (initialContext != null)
{
initialContext.close();
}
if (connection != null)
{
connection.close();
}
}</code>
</pre>
</ol>
<hr>
<ol>
<li><aid="fn1"/>The stores were generating using the following commands <ahref="readme.html#fnr1">↩</a>:
<ul>
<li>create the keystore: <code>keytool -genkey -keystore hornetq.example.keystore -storepass hornetqexample</code></li>
<li>export the certificate: <code>keytool -export -keystore hornetq.example.keystore -file hornetq.cer</code></li>