What is the easiest way to do that?
Use JSSE and configure to use Diffie Hellman.
JSSE
is Java's socket extension for SSL
. Using the SecureSocket
classes which provide the same interface as regular sockets (so your current code does not need to change) but operate over SSL
you can achieve encryption in your network connectivity.
You should study the link provided to see how to configure to do what you need.