}
}
public Socket negotiateSSL(final Socket sock) throws Exception {
SSLSocket sslsock;
try {
sslsock=(SSLSocket)this.sslSocketFactory.createSocket(
sock,
sock.getInetAddress().getHostAddress(),
sock.getPort(),
true);
sslsock.addHandshakeCompletedListener(
new HandshakeCompletedListener() {
public void handshakeCompleted(
final HandshakeCompletedEvent event) {
System.out.println("Handshake finished!");
System.out.println(
"\t CipherSuite:" + event.getCipherSuite());
System.out.println(
"\t SessionId " + event.getSession());
System.out.println(
"\t PeerHost " + event.getSession().getPeerHost());
}
}
);
sslsock.setUseClientMode(false);
final String[] suites = sslsock.getSupportedCipherSuites();
sslsock.setEnabledCipherSuites(suites);
// start handshake
sslsock.startHandshake();
//String cipherSuite = sslsock.getSession().getCipherSuite();
return sslsock;
} catch (final Exception e) {