My servlet is deployed in jboss and my client is a simple java program, that communicates with the client. I have a few demo certificates. How should I add the certificates to the client and server. Remember My client is not a browser it is a java program.
This is certainly non-trivial.
Since your client is a normal java program you have to look into JSSE http://docs.oracle.com/javase/7/docs/technotes/guides/security/jsse/JSSERefGuide.html to fully understand how to read a client certificate and make a connection with it. On the jboss side there should be documentation on how to install the server certificate, enable SSL and peer verification. If you are using tomcat as web container in jboss, check out http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html
I recommend the book "Cryptography in Java" which has a lot of examples, it helped me a lot.
If you don't need the certificate information in your programs, you could use a tunnel like stunnel to encrypt and authenticate the connection.