throws NoSuchAlgorithmException, KeyManagementException, IOException,
CertificateException, UnrecoverableKeyException, KeyStoreException
{
ServerSocketFactory serverSocketFactory = null;
SSLSocketBuilder server = new SSLSocketBuilder();
server.setUseSSLServerSocketFactory(false);
server.setSecureSocketProtocol("SSL");
server.setTrustStoreAlgorithm("SunX509");
server.setTrustStoreType("JKS");
String trustStoreFilePath = this.getClass().getResource("../.truststore").getFile();
server.setTrustStoreURL(trustStoreFilePath);
server.setTrustStorePassword("unit-tests-client");
// server.setUseClientMode(true);
server.setServerSocketUseClientMode(true);
server.setSocketUseClientMode(false);
/*
* This is optional since if not set, will use
* the key store password (and are the same in this case)
*/
//server.setKeyPassword("unit-tests-server");
serverSocketFactory = server.createSSLServerSocketFactory();
return serverSocketFactory;
}