if (clientSock == null) {
clientSock = sipStack.getNetworkLayer()
.createSSLSocket(receiverAddress, contactPort,
senderAddress);
SSLSocket sslsock = (SSLSocket) clientSock;
if (sipStack.isLoggingEnabled(LogWriter.TRACE_DEBUG)) {
sipStack.getStackLogger().logDebug(
"inaddr = " + receiverAddress);
sipStack.getStackLogger().logDebug(
"port = " + contactPort);
}
HandshakeCompletedListener listner = new HandshakeCompletedListenerImpl(
(TLSMessageChannel) messageChannel);
((TLSMessageChannel) messageChannel)
.setHandshakeCompletedListener(listner);
sslsock.addHandshakeCompletedListener(listner);
sslsock.setEnabledProtocols(sipStack
.getEnabledProtocols());
sslsock.startHandshake();
if (sipStack.isLoggingEnabled(LogWriter.TRACE_DEBUG)) {
this.sipStack.getStackLogger().logDebug(
"Handshake passed");
}
// allow application to enforce policy by validating the