protected ServiceCallout()

in callouts/java/service-callout/src/main/java/service/ServiceCallout.java [70:101]


    protected ServiceCallout(Builder<?> builder) {
        this.ip = Optional.ofNullable(builder.ip).orElse("0.0.0.0");
        this.port = Optional.ofNullable(builder.port).orElse(443);
        this.plaintextPort = Optional.ofNullable(builder.plaintextPort).orElse(8080);
        this.healthCheckIp = Optional.ofNullable(builder.healthCheckIp).orElse("0.0.0.0");
        this.healthCheckPort = Optional.ofNullable(builder.healthCheckPort).orElse(80);
        this.healthCheckPath = Optional.ofNullable(builder.healthCheckPath).orElse("/");
        this.combinedHealthCheck = Optional.ofNullable(builder.combinedHealthCheck).orElse(false);

        // Handle cert path and cert data
        this.certPath = Optional.ofNullable(builder.certPath).orElse("certs/server.crt");
        this.cert = Optional.ofNullable(builder.cert)
                .orElseGet(() -> readFileToBytes(this.certPath)); // Read using final path

        // Handle cert key path and cert key data
        this.certKeyPath = Optional.ofNullable(builder.certKeyPath).orElse("certs/pkcs8_key.pem");
        this.certKey = Optional.ofNullable(builder.certKey)
                .orElseGet(() -> readFileToBytes(this.certKeyPath)); // Read using final path

        this.serverThreadCount = Optional.ofNullable(builder.serverThreadCount).orElse(2);
        this.enablePlainTextPort = Optional.ofNullable(builder.enablePlainTextPort).orElse(true);

        // Initialize health check server if enabled
        if (!this.combinedHealthCheck) {
            try {
                initHealthCheckServer();
            } catch (IOException e) {
                logger.log(Level.SEVERE, "Failed to initialize Health Check Server", e);
                throw new RuntimeException(e);
            }
        }
    }