diff --git a/src/main/java/monero/common/MoneroConnectionManager.java b/src/main/java/monero/common/MoneroConnectionManager.java index 2e09950a..20a4be79 100644 --- a/src/main/java/monero/common/MoneroConnectionManager.java +++ b/src/main/java/monero/common/MoneroConnectionManager.java @@ -360,7 +360,7 @@ public MoneroConnectionManager checkConnection() { MoneroRpcConnection connection = getConnection(); if (connection != null) { if (connection.checkConnection(timeoutMs)) connectionChanged = true; - if (processResponses(Arrays.asList(connection)) != null) return this; // done if connection set from responses + processResponses(Arrays.asList(connection)); } if (autoSwitch && !isConnected()) { MoneroRpcConnection bestConnection = getBestAvailableConnection(connection); diff --git a/src/test/java/TestMoneroConnectionManager.java b/src/test/java/TestMoneroConnectionManager.java index 9ef52346..1631baee 100644 --- a/src/test/java/TestMoneroConnectionManager.java +++ b/src/test/java/TestMoneroConnectionManager.java @@ -168,10 +168,9 @@ public void testConnectionManager() throws InterruptedException, IOException { assertEquals(++numExpectedChanges, listener.changedConnections.size()); // connect to specific endpoint with authentication - connectionManager.setAutoSwitch(false); orderedConnections.get(1).setCredentials("rpc_user", "abc123"); connectionManager.checkConnection(); - assertEquals(connection.getUri(), walletRpcs.get(1).getRpcConnection().getUri()); + assertEquals(connectionManager.getConnection().getUri(), walletRpcs.get(1).getRpcConnection().getUri()); assertTrue(connection.isOnline()); assertTrue(connection.isAuthenticated()); assertEquals(++numExpectedChanges, listener.changedConnections.size()); @@ -211,7 +210,6 @@ public void testConnectionManager() throws InterruptedException, IOException { assertEquals(++numExpectedChanges, listener.changedConnections.size()); // check all connections and test auto switch - connectionManager.setAutoSwitch(true); connectionManager.checkConnections(); assertEquals(++numExpectedChanges, listener.changedConnections.size()); assertTrue(connectionManager.isConnected());