public void listenAndBind() {
            try (Connection connection = PostgresMessenger.this.sqlStorage.getConnectionFactory().getConnection()) {
                try (Statement s = connection.createStatement()) {
                    s.execute("LISTEN \"" + CHANNEL + "\"");
                }

                PGConnection pgConnection = connection.unwrap(PGConnection.class);
                this.listeningThread.set(Thread.currentThread());

                while (this.open.get()) {
                    PGNotification[] notifications = pgConnection.getNotifications(RECEIVE_TIMEOUT_MILLIS);
                    if (notifications != null) {
                        for (PGNotification notification : notifications) {
                            handleNotification(notification);
                        }
                    }
                }

            } catch (PSQLException e) {
                if (!(e.getCause() instanceof SocketException && e.getCause().getMessage().equals("Socket closed"))) {
                    e.printStackTrace();
                }
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                this.listeningThread.set(null);
            }
        }
Checks the connection, and re-opens it if necessary.

@return true if the connection is now alive, false otherwise
common/src/main/java/me/lucko/luckperms/common/messaging/postgres/PostgresMessenger.java