=doc #15772 Make IPv6 multicast tests work on OS X
* Fixed a small race by waiting for the listenert to be bound * Changed the Java test to test the Java code (imported the wrong class) * Changed to a known link local multicas address (the old one just gave me a nop route to host)
This commit is contained in:
parent
dd71de5f93
commit
cd90acef96
4 changed files with 42 additions and 17 deletions
|
|
@ -80,10 +80,13 @@ public class JavaUdpMulticast {
|
|||
public void onReceive(Object msg) {
|
||||
if (msg instanceof Udp.Bound) {
|
||||
final Udp.Bound b = (Udp.Bound) msg;
|
||||
log.info("Bound to " + b.localAddress());
|
||||
log.info("Bound to {}", b.localAddress());
|
||||
sink.tell(b, getSelf());
|
||||
} else if (msg instanceof Udp.Received) {
|
||||
final Udp.Received r = (Udp.Received) msg;
|
||||
log.info("Received '" + r.data().decodeString("utf-8") + "' from '" + r.sender() + "'");
|
||||
final String txt = r.data().decodeString("utf-8");
|
||||
log.info("Received '{}' from {}", txt, r.sender());
|
||||
sink.tell(txt, getSelf());
|
||||
} else unhandled(msg);
|
||||
}
|
||||
}
|
||||
|
|
@ -91,11 +94,13 @@ public class JavaUdpMulticast {
|
|||
public static class Sender extends UntypedActor {
|
||||
LoggingAdapter log = Logging.getLogger(getContext().system(), this);
|
||||
|
||||
String iface;
|
||||
String group;
|
||||
Integer port;
|
||||
String message;
|
||||
|
||||
public Sender(String group, Integer port, String msg) {
|
||||
public Sender(String iface, String group, Integer port, String msg) {
|
||||
this.iface = iface;
|
||||
this.group = group;
|
||||
this.port = port;
|
||||
this.message = msg;
|
||||
|
|
@ -110,7 +115,7 @@ public class JavaUdpMulticast {
|
|||
@Override
|
||||
public void onReceive(Object msg) {
|
||||
if (msg instanceof Udp.SimpleSenderReady) {
|
||||
InetSocketAddress remote = new InetSocketAddress(group, port);
|
||||
InetSocketAddress remote = new InetSocketAddress(group + "%" + iface, port);
|
||||
log.info("Sending message to " + remote);
|
||||
getSender().tell(UdpMessage.send(ByteString.fromString(message), remote), getSelf());
|
||||
} else unhandled(msg);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue