private ServerSocket createHttpsServerSocket()
      throws IOException, GeneralSecurityException, URISyntaxException {
    KeyStore keyStore = KeyStore.getInstance("JKS");
    // generated with: keytool -genkey -keyalg RSA -keystore ./TestWebServer-keystore
    Path keyStoreFile = Paths.get(Resources.getResource("core/TestWebServer-keystore").toURI());
    try (InputStream in = Files.newInputStream(keyStoreFile)) {
      keyStore.load(in, "password".toCharArray());
    }

    KeyManagerFactory keyManagerFactory =
        KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
    keyManagerFactory.init(keyStore, "password".toCharArray());

    SSLContext sslContext = SSLContext.getInstance("TLS");
    sslContext.init(keyManagerFactory.getKeyManagers(), null, null);
    return sslContext.getServerSocketFactory().createServerSocket(0);
  }
Simple local web server for testing.
jib-core/src/test/java/com/google/cloud/tools/jib/http/TestWebServer.java