private Set<Integer> getInternalPorts(Set<Integer> externalLivenessCheckPorts, List<Integer> exposedPorts) {
        return exposedPorts
            .stream()
            .filter(it -> externalLivenessCheckPorts.contains(waitStrategyTarget.getMappedPort(it)))
            .collect(Collectors.toSet());
    }
Waits until a socket connection can be established on a port exposed or mapped by the container.
core/src/main/java/org/testcontainers/containers/wait/strategy/HostPortWaitStrategy.java