Fix RSocket samples test

This commit is contained in:
Oleg Zhurakousky
2020-12-21 11:57:55 +01:00
parent 77edae56fe
commit 8b5ce53a63
2 changed files with 12 additions and 4 deletions

View File

@@ -1,5 +1,7 @@
package io.spring.cloudevent;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.Collections;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.TimeUnit;
@@ -60,11 +62,13 @@ public class DemoApplicationTests {
try {
new CachingConnectionFactory("localhost").createConnection();
try {
KafkaAdminClient.create(Collections.singletonMap("bootstrap.servers", "localhost:9092"));
Socket socket = new Socket();
socket.connect(new InetSocketAddress("localhost", 9092));
socket.close();
}
catch (Exception e) {
System.out.println("Kafka is not available on localhost:9092");
return ConditionEvaluationResult.enabled("Kafka is not available on localhost, default port");
return ConditionEvaluationResult.disabled("Kafka is not available on localhost, default port");
}
}
catch (Exception e) {