Skip to content

Commit 31764f0

Browse files
author
Simon MacMullen
committed
Prevent some client tests from blowing up.
1 parent 96f7828 commit 31764f0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/com/rabbitmq/client/impl/AMQConnection.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ public void start()
242242

243243
// start the main loop going
244244
Thread ml = new MainLoop();
245-
ml.setName("AMQP Connection " + getAddress().getHostAddress() + ":" + getPort());
245+
ml.setName("AMQP Connection " + getHostAddress() + ":" + getPort());
246246
ml.start();
247247

248248
AMQP.Connection.Start connStart = null;
@@ -560,7 +560,7 @@ public void handleConnectionClose(Command closeCommand) {
560560
_brokerInitiatedShutdown = true;
561561
Thread scw = new SocketCloseWait(sse);
562562
scw.setName("AMQP Connection Closing Monitor " +
563-
getAddress().getHostAddress() + ":" + getPort());
563+
getHostAddress() + ":" + getPort());
564564
scw.start();
565565
}
566566

@@ -727,6 +727,10 @@ public void close(int closeCode,
727727
}
728728

729729
@Override public String toString() {
730-
return "amqp://" + _factory.getUsername() + "@" + getAddress().getHostAddress() + ":" + getPort() + _virtualHost;
730+
return "amqp://" + _factory.getUsername() + "@" + getHostAddress() + ":" + getPort() + _virtualHost;
731+
}
732+
733+
private String getHostAddress() {
734+
return getAddress() == null ? null : getAddress().getHostAddress();
731735
}
732736
}

0 commit comments

Comments
 (0)