public static SocketAddress updatePort(@Nullable Supplier<? extends SocketAddress> address, int port) {
		if (address == null) {
			return createUnresolved(NetUtil.LOCALHOST.getHostAddress(), port);
		}

		SocketAddress socketAddress = address.get();
		if (socketAddress instanceof DomainSocketAddress) {
			throw new IllegalArgumentException("Cannot update DomainSocketAddress with post number [" + port + "].");
		}

		if (!(address.get() instanceof InetSocketAddress)) {
			return createUnresolved(NetUtil.LOCALHOST.getHostAddress(), port);
		}

		InetSocketAddress inet = (InetSocketAddress) address.get();

		InetAddress addr = inet.getAddress();

		String host = addr == null ? inet.getHostName() : addr.getHostAddress();

		return createUnresolved(host, port);
	}
@Test
	void updatePortBadValues() {
		assertThatExceptionOfType(IllegalArgumentException.class)
				.isThrownBy(() -> AddressUtils.updatePort(null, -1))
				.withMessage("port out of range:-1");
	}