Skip to content
Permalink
Browse files
8265362: java/net/Socket/UdpSocket.java fails with "java.net.BindExce…
…ption: Address already in use" (macos-aarch64)

Reviewed-by: dfuchs, alanb
  • Loading branch information
Mark Sheppard committed May 24, 2021
1 parent 640a2af commit bb085f684d1154ffd6b2169259c67cfb19958380
Showing with 11 additions and 4 deletions.
  1. +0 −1 test/jdk/ProblemList.txt
  2. +11 −3 test/jdk/java/net/Socket/UdpSocket.java
@@ -608,7 +608,6 @@ java/net/MulticastSocket/SetGetNetworkInterfaceTest.java 8219083 windows-

java/net/ServerSocket/AcceptInheritHandle.java 8211854 aix-ppc64

java/net/Socket/UdpSocket.java 8265362 macosx-aarch64

java/net/httpclient/websocket/PendingBinaryPongClose.java 8265367 macosx-aarch64
java/net/httpclient/websocket/PendingBinaryPingClose.java 8265367 macosx-aarch64
@@ -37,9 +37,9 @@
import java.nio.channels.DatagramChannel;
import java.security.Permission;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.ArrayDeque;
import java.util.Deque;
import java.net.BindException;

import org.testng.annotations.Test;
import static org.testng.Assert.*;
@@ -59,7 +59,6 @@ public void testSendReceive() throws IOException {

int port = ((InetSocketAddress) dc.getLocalAddress()).getPort();
try (Socket s = new Socket(loopback, port, false)) {

// send datagram with socket output stream
byte[] array1 = MESSAGE.getBytes("UTF-8");
s.getOutputStream().write(array1);
@@ -133,8 +132,17 @@ public void testMaxSockets() throws Exception {
}
}


private Socket newUdpSocket() throws IOException {
return new Socket(InetAddress.getLoopbackAddress(), 8000, false);
Socket s = null;

try {
s = new Socket(InetAddress.getLoopbackAddress(), 8000, false);
} catch (BindException unexpected) {
System.out.println("BindException caught retry Socket creation");
s = new Socket(InetAddress.getLoopbackAddress(), 8000, false);
}
return s;
}

private void closeAll(Deque<Socket> sockets) throws IOException {

1 comment on commit bb085f6

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on bb085f6 May 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.