<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE programlisting PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
]>
<!-- Automatically generated file.  Do not edit. -->
<programlisting language="Java">
// Create the socket and connect it at the TCP layer.
SSLSocket socket = (SSLSocket) ctx.getSocketFactory()
    .createSocket(host, port);

// Disable the Nagle algorithm.
socket.setTcpNoDelay(true);

// Adjust ciphers and protocols.
socket.setSSLParameters(params);

// Perform the handshake.
socket.startHandshake();

// Validate the host name.  The match() method throws
// CertificateException on failure.
X509Certificate peer = (X509Certificate)
    socket.getSession().getPeerCertificates()[0];
// This is the only way to perform host name checking on OpenJDK 6.
HostnameChecker.getInstance(HostnameChecker.TYPE_TLS).match(
    host, peer);
</programlisting>
