I've been trying to subscribe to a port using redis's message broker on my localhost. I'm using the jedis api for this.
When I try to connect, I keep getting the error connection refused
. I tried 5 different ports that should be free, and I tried using both "localhost" and "0.0.0.0" for the hostname.
This is what I tried:
private static final int PORT = 25564;private static final String HOST = "0.0.0.0";private Jedis jedis = new Jedis(HOST,PORT);private JedisPubSub arenaEventHandler = new JedisPubSub() { @Override public void onMessage(String channel, String message) { getLogger().info("received message on " + channel +": " + message); }};private void setupArenaSubscription(){ getProxy().getScheduler().runAsync(this, () -> { try { jedis.psubscribe(arenaEventHandler, "ARENA*"); getLogger().info("Subscription ended."); } catch (Exception e) { getLogger().log(Level.SEVERE,"Subscribing failed.", e); } });}
As you can see I'm also using the BungeeCord api, but this shouldn't be influencing the connection.
The error is occuring in the try-catch-block when I call pSubscribe
. I hope that anyone can help me with this issue.