SSL connection with Openfire 4.0.1

I am using latest smack library and openfire setup. My non SSL connection with openfire over port 5222 works fantastic! But now I want to connect using SSL. I tried connecting to ports 5222 and 5223 where I have enabled tls. But I get errors in connection. Can someone give a guild how to setup SSL using self signed certificates.