public void init(String address, String username, String password, boolean ssl) {
        String[] addressSplit = address.split(":");
        String host = addressSplit[0];
        int port = addressSplit.length > 1 ? Integer.parseInt(addressSplit[1]) : Options.DEFAULT_PORT;

        this.connection = createConnection(builder -> {
            builder.server("nats://" + host + ":" + port)
                    .reconnectWait(Duration.ofSeconds(5))
                    .maxReconnects(Integer.MAX_VALUE)
                    .connectionName("LuckPerms");

            if (username != null && password != null) {
                builder.userInfo(username, password);
            }

            if (ssl) {
                builder.secure();
            }
        });
        this.messageDispatcher = this.connection.createDispatcher(new Handler()).subscribe(CHANNEL);
    }
An implementation of Messenger for Nats messaging client.
common/src/main/java/me/lucko/luckperms/common/messaging/nats/NatsMessenger.java