File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
src/test/java/com/rabbitmq/stream Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,11 @@ private static Process executeCommand(String command) throws IOException {
5555 return pr ;
5656 }
5757
58+ public static String hostname () throws IOException {
59+ Process process = executeCommand ("hostname" );
60+ return capture (process .getInputStream ()).trim ();
61+ }
62+
5863 private static int waitForExitValue (Process pr ) {
5964 while (true ) {
6065 try {
Original file line number Diff line number Diff line change 2020import com .rabbitmq .stream .Constants ;
2121import com .rabbitmq .stream .Host ;
2222import com .rabbitmq .stream .impl .Client .Broker ;
23+ import java .io .IOException ;
2324import java .net .InetAddress ;
2425import java .net .UnknownHostException ;
2526import java .util .*;
@@ -144,7 +145,11 @@ static String hostname() {
144145 try {
145146 return InetAddress .getLocalHost ().getHostName ();
146147 } catch (UnknownHostException e ) {
147- throw new RuntimeException (e );
148+ try {
149+ return Host .hostname ();
150+ } catch (IOException ex ) {
151+ throw new RuntimeException (ex );
152+ }
148153 }
149154 }
150155}
You can’t perform that action at this time.
0 commit comments