private void handleOutgoing(String channel, byte[] message) {
        // Handle outgoing messages: just send a HTTP POST request to the remote server.
        try {
            HttpURLConnection connection = (HttpURLConnection) this.remoteUrl.apply(encodeChannel(channel)).openConnection();
            connection.setRequestMethod("POST");
            connection.setDoInput(false);
            connection.setDoOutput(true);
            connection.setUseCaches(false);

            connection.connect();
            try (OutputStream out = connection.getOutputStream()) {
                out.write(message);
            }

            if (connection.getResponseCode() >= 400) {
                throw new IOException("Response code: " + connection.getResponseCode() + " - " + connection.getResponseMessage());
            }

            connection.disconnect();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
A factory which creates remote URLs for outgoing messages
helper/src/main/java/me/lucko/helper/messaging/http/HttpMessenger.java