driver-core/src/main/com/mongodb/ServerAddress.java
public List<InetSocketAddress> getSocketAddresses() {
        try {
            InetAddress[] inetAddresses = InetAddress.getAllByName(host);
            List<InetSocketAddress> inetSocketAddressList = new ArrayList<InetSocketAddress>();
            for (InetAddress inetAddress : inetAddresses) {
                inetSocketAddressList.add(new InetSocketAddress(inetAddress, port));
            }

            return inetSocketAddressList;
        } catch (UnknownHostException e) {
            throw new MongoSocketException(e.getMessage(), this, e);
        }
    }
public List<InetSocketAddress> getSocketAddresses() {
        try {
            InetAddress[] inetAddresses = InetAddress.getAllByName(host);
            List<InetSocketAddress> inetSocketAddressList = new ArrayList<InetSocketAddress>();
            for (InetAddress inetAddress : inetAddresses) {
                inetSocketAddressList.add(new InetSocketAddress(inetAddress, port));
            }

            return inetSocketAddressList;
        } catch (UnknownHostException e) {
            throw new MongoSocketException(e.getMessage(), this, e);
        }
    }
Gets all underlying socket addresses

@return array of socket addresses

@since 3.9