This gives sample Java code for working with secure connections. There are currently two packages, each dealing with one aspect of security:
com.sosnoski.certs- Code for working with certificates for secure connections
com.sosnoski.tls- Code for controlling the secure connection type (protocol and cipher suite)
The root directory includes Eclipse project files you can import into your workspace.