public NetworkConfig setPort(int port) {
        if (port < 0 || port > PORT_MAX) {
            throw new IllegalArgumentException("Port out of range: " + port + ". Allowed range [0,65535]");
        }
        this.port = port;
        return this;
    }
@Test(expected = IllegalArgumentException.class)
    public void testNegativePort() {
        int port = -1;
        networkConfig.setPort(port);
    }