private static ServerSocket getServerSocket(final int port, final boolean ssl) throws Exception {
        if (port == 8443 || ssl) {
            val sslContext = SSLContext.getInstance("SSL");
            var keyStore = KeyStore.getInstance("JKS");
            keyStore.load(new ClassPathResource("localhost.keystore").getInputStream(), "changeit".toCharArray());
            val keyManagerFactory = KeyManagerFactory.getInstance("SunX509");
            keyManagerFactory.init(keyStore, "changeit".toCharArray());
            sslContext.init(keyManagerFactory.getKeyManagers(), new TrustManager[]{new X509TrustManager() {
                @Override
                public void checkClientTrusted(final X509Certificate[] xcs, final String string) {
                }

                @Override
                public void checkServerTrusted(final X509Certificate[] xcs, final String string) {
                }

                @Override
                public X509Certificate[] getAcceptedIssuers() {
                    return null;
                }
            }}, RandomUtils.getNativeInstance());
            val addr = new InetSocketAddress("0.0.0.0", port);
            return sslContext.getServerSocketFactory().createServerSocket(port, 0, addr.getAddress());
        }
        val serverSocket = new ServerSocket(port);
        serverSocket.setSoTimeout(30000);
        return serverSocket;
    }
Provides a simple HTTP Web server that can serve out a single resource for
all requests.  SSL/TLS is not supported.

@author Marvin S. Addison
@since 3.4.6
core/cas-server-core-util-api/src/test/java/org/apereo/cas/util/MockWebServer.java