// Path: src/main/java/spark/ssl/SslStores.java
// public class SslStores {
// 
//     protected String keystoreFile;
//     protected String keystorePassword;
//     protected String certAlias;
//     protected String truststoreFile;
//     protected String truststorePassword;
//     protected boolean needsClientCert;
// 
//     /**
//      * Creates a Stores instance.
//      *
//      * @param keystoreFile the keystoreFile
//      * @param keystorePassword the keystorePassword
//      * @param truststoreFile the truststoreFile
//      * @param truststorePassword the truststorePassword
//      * @return the SslStores instance.
//      */
//     public static SslStores create(String keystoreFile,
//                                 String keystorePassword,
//                                 String truststoreFile,
//                                 String truststorePassword) {
// 
//         return new SslStores(keystoreFile, keystorePassword, null, truststoreFile, truststorePassword, false);
//     }
// 
//     public static SslStores create(String keystoreFile,
//                                 String keystorePassword,
//                                 String certAlias,
//                                 String truststoreFile,
//                                 String truststorePassword) {
// 
//         return new SslStores(keystoreFile, keystorePassword, certAlias, truststoreFile, truststorePassword, false);
//     }
// 
//     public static SslStores create(String keystoreFile,
//                                    String keystorePassword,
//                                    String truststoreFile,
//                                    String truststorePassword,
//                                    boolean needsClientCert) {
// 
//         return new SslStores(keystoreFile, keystorePassword, null, truststoreFile, truststorePassword, needsClientCert);
//     }
// 
//     public static SslStores create(String keystoreFile,
//                                    String keystorePassword,
//                                    String certAlias,
//                                    String truststoreFile,
//                                    String truststorePassword,
//                                    boolean needsClientCert) {
// 
//         return new SslStores(keystoreFile, keystorePassword, certAlias, truststoreFile, truststorePassword, needsClientCert);
//     }
// 
//     private SslStores(String keystoreFile,
//                       String keystorePassword,
//                       String certAlias,
//                       String truststoreFile,
//                       String truststorePassword,
//                       boolean needsClientCert) {
//         this.keystoreFile = keystoreFile;
//         this.keystorePassword = keystorePassword;
//         this.certAlias = certAlias;
//         this.truststoreFile = truststoreFile;
//         this.truststorePassword = truststorePassword;
//         this.needsClientCert = needsClientCert;
//     }
// 
//     /**
//      * @return keystoreFile
//      */
//     public String keystoreFile() {
//         return keystoreFile;
//     }
// 
//     /**
//      * @return keystorePassword
//      */
//     public String keystorePassword() {
//         return keystorePassword;
//     }
// 
//     /**
//      * @return certAlias
//      */
//     public String certAlias() {
//         return certAlias;
//     }
// 
//     /**
//      * @return trustStoreFile
//      */
//     public String trustStoreFile() {
//         return truststoreFile;
//     }
// 
//     /**
//      * @return trustStorePassword
//      */
//     public String trustStorePassword() {
//         return truststorePassword;
//     }
// 
//     /**
//      * @return needsClientCert
//      */
//     public boolean needsClientCert() {
//         return needsClientCert;
//     }
// }


import org.eclipse.jetty.server.ConnectionFactory;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.junit.Test;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.reflect.Whitebox;
import spark.ssl.SslStores;
import java.util.Map;
import static org.junit.Assert.*;
            assertEquals("'host' must not be null", ex.getMessage());
        }
    }

    @Test
    public void testCreateSecureSocketConnector_whenSslStoresIsNull() {

        Server server = new Server();

        try {
            SocketConnectorFactory.createSecureSocketConnector(server, "localhost", 80, null, true);
            fail("SocketConnector creation should have thrown an IllegalArgumentException");
        } catch(IllegalArgumentException ex) {
            assertEquals("'sslStores' must not be null", ex.getMessage());
        }
    }


    @Test
    @PrepareForTest({ServerConnector.class})
    public void testCreateSecureSocketConnector() throws  Exception {

        final String host = "localhost";
        final int port = 8888;

        final String keystoreFile = "keystoreFile.jks";
        final String keystorePassword = "keystorePassword";
        final String truststoreFile = "truststoreFile.jks";
        final String trustStorePassword = "trustStorePassword";

// Path: src/main/java/spark/ssl/SslStores.java
// public class SslStores {
// 
//     protected String keystoreFile;
//     protected String keystorePassword;
//     protected String certAlias;
//     protected String truststoreFile;
//     protected String truststorePassword;
//     protected boolean needsClientCert;
// 
//     /**
//      * Creates a Stores instance.
//      *
//      * @param keystoreFile the keystoreFile
//      * @param keystorePassword the keystorePassword
//      * @param truststoreFile the truststoreFile
//      * @param truststorePassword the truststorePassword
//      * @return the SslStores instance.
//      */
//     public static SslStores create(String keystoreFile,
//                                 String keystorePassword,
//                                 String truststoreFile,
//                                 String truststorePassword) {
// 
//         return new SslStores(keystoreFile, keystorePassword, null, truststoreFile, truststorePassword, false);
//     }
// 
//     public static SslStores create(String keystoreFile,
//                                 String keystorePassword,
//                                 String certAlias,
//                                 String truststoreFile,
//                                 String truststorePassword) {
// 
//         return new SslStores(keystoreFile, keystorePassword, certAlias, truststoreFile, truststorePassword, false);
//     }
// 
//     public static SslStores create(String keystoreFile,
//                                    String keystorePassword,
//                                    String truststoreFile,
//                                    String truststorePassword,
//                                    boolean needsClientCert) {
// 
//         return new SslStores(keystoreFile, keystorePassword, null, truststoreFile, truststorePassword, needsClientCert);
//     }
// 
//     public static SslStores create(String keystoreFile,
//                                    String keystorePassword,
//                                    String certAlias,
//                                    String truststoreFile,
//                                    String truststorePassword,
//                                    boolean needsClientCert) {
// 
//         return new SslStores(keystoreFile, keystorePassword, certAlias, truststoreFile, truststorePassword, needsClientCert);
//     }
// 
//     private SslStores(String keystoreFile,
//                       String keystorePassword,
//                       String certAlias,
//                       String truststoreFile,
//                       String truststorePassword,
//                       boolean needsClientCert) {
//         this.keystoreFile = keystoreFile;
//         this.keystorePassword = keystorePassword;
//         this.certAlias = certAlias;
//         this.truststoreFile = truststoreFile;
//         this.truststorePassword = truststorePassword;
//         this.needsClientCert = needsClientCert;
//     }
// 
//     /**
//      * @return keystoreFile
//      */
//     public String keystoreFile() {
//         return keystoreFile;
//     }
// 
//     /**
//      * @return keystorePassword
//      */
//     public String keystorePassword() {
//         return keystorePassword;
//     }
// 
//     /**
//      * @return certAlias
//      */
//     public String certAlias() {
//         return certAlias;
//     }
// 
//     /**
//      * @return trustStoreFile
//      */
//     public String trustStoreFile() {
//         return truststoreFile;
//     }
// 
//     /**
//      * @return trustStorePassword
//      */
//     public String trustStorePassword() {
//         return truststorePassword;
//     }
// 
//     /**
//      * @return needsClientCert
//      */
//     public boolean needsClientCert() {
//         return needsClientCert;
//     }
// }


// Path: src/test/java/spark/embeddedserver/jetty/SocketConnectorFactoryTest.java
import org.eclipse.jetty.server.ConnectionFactory;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.junit.Test;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.reflect.Whitebox;
import spark.ssl.SslStores;
import java.util.Map;
import static org.junit.Assert.*;

            assertEquals("'host' must not be null", ex.getMessage());
        }
    }

    @Test
    public void testCreateSecureSocketConnector_whenSslStoresIsNull() {

        Server server = new Server();

        try {
            SocketConnectorFactory.createSecureSocketConnector(server, "localhost", 80, null, true);
            fail("SocketConnector creation should have thrown an IllegalArgumentException");
        } catch(IllegalArgumentException ex) {
            assertEquals("'sslStores' must not be null", ex.getMessage());
        }
    }


    @Test
    @PrepareForTest({ServerConnector.class})
    public void testCreateSecureSocketConnector() throws  Exception {

        final String host = "localhost";
        final int port = 8888;

        final String keystoreFile = "keystoreFile.jks";
        final String keystorePassword = "keystorePassword";
        final String truststoreFile = "truststoreFile.jks";
        final String trustStorePassword = "trustStorePassword";

        SslStores sslStores = SslStores.create(keystoreFile, keystorePassword, truststoreFile, trustStorePassword);