int nextAvailableBaseport(int numPorts) {
        int range = 0;
        int port = BASE_PORT;
        for (; port < BASE_PORT + MAX_PORTS && (range < numPorts); port++) {
            if (!isFree(port)) {
                range = 0;
                continue;
            }
            range++;
        }
        return range == numPorts ? port - range : 0;
    }
@Test
    void next_available_baseport_is_BASE_PORT_when_no_ports_have_been_reserved() {
        HostPorts host = new HostPorts("myhostname");
        assertThat(host.nextAvailableBaseport(1), is(HostPorts.BASE_PORT));
    }