protected void createAndStartGrpcServer() throws IOException {
        if (this.server == null) {
            final Server localServer = this.factory.createServer();
            this.server = localServer;
            localServer.start();
            final String address = this.factory.getAddress();
            final int port = this.factory.getPort();
            log.info("gRPC Server started, listening on address: {}, port: {}", address, port);
            this.eventPublisher.publishEvent(new GrpcServerStartedEvent(this, localServer, address, port));

            // Prevent the JVM from shutting down while the server is running
            final Thread awaitThread = new Thread(() -> {
                try {
                    localServer.awaitTermination();
                } catch (final InterruptedException e) {
                    Thread.currentThread().interrupt();
                }
            });
            awaitThread.setName("grpc-server-container-" + (serverCounter.incrementAndGet()));
            awaitThread.setDaemon(false);
            awaitThread.start();
        }
    }
Creates and starts the grpc server.

@throws IOException If the server is unable to bind the port.
grpc-server-spring-boot-starter/src/main/java/net/devh/boot/grpc/server/serverfactory/GrpcServerLifecycle.java