On Tue, 19 Apr 2022 16:07:29 GMT, Daniel Fuchs <dfu...@openjdk.org> wrote:

>> I'm not sure there is value in testing all of these permutations. 
>> Distinguishing DatagramChannel and DatagramSocket probably made sense, but 
>> it's all the same implementation under the hood.
>
> 1. `DatagramChannel.open()` => opens a dual socket unless 
> `-Djava.net.preferIPv4Stack=true`, in which case it should be equivalent to 
> `DatagramChannel.open(StandardProtocolFamily.INET)`
> 2. `DatagramChannel.open(StandardProtocolFamily.INET)` => opens an IPv4 socket
> 3. `DatagramChannel.open(StandardProtocolFamily.INET6)` => opens an IPv6 
> socket
> 
> So I believe it makes sense to test the no-arg constructor since that's the 
> only way to open a dual socket.

I don't mind adding it. Though, the no-arg constructor is the same as cases 2. 
or 3. depending on the value of the preferIPv4Stack property.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8245

Reply via email to