1 parent 6a0eb1b commit b6ab7a6Copy full SHA for b6ab7a6
2 files changed
src/main/java/io/github/intisy/utils/custom/external/Redis.java
@@ -79,7 +79,7 @@ private int findFreePort() {
79
}
80
81
public void connect() throws IOException {
82
- if (useEmbedded) {
+ if (useEmbedded && isPortAvailable(port) && isPortAvailable(port + 1)) {
83
try {
84
startEmbeddedServer();
85
} catch (IOException e) {
src/test/java/io/github/intisy/utils/custom/external/TestRedis.java
@@ -28,8 +28,7 @@ private static void testWithEmbeddedRedis() {
28
29
30
System.out.println("Attempting to connect to embedded Redis server...");
31
- if (redis.isPortAvailable(redis.getPort()))
32
- redis.connect();
+ redis.connect();
33
34
if (redis.isConnected()) {
35
System.out.println("Embedded Redis server is running");
0 commit comments