class NetworkAddressValidator implements Validator<NetworkAddress> {

  @Override
  public boolean isValid(NetworkAddress networkAddress) {
    if (networkAddress == null) {
      return false;
    }

    String ip = networkAddress.ip();
    int port = networkAddress.port();
    if (ip == null || ip.isEmpty() || port <= 0 || port > 65535) {
      return false;
    }

    InetAddressValidator inetAddressValidator = InetAddressValidator.getInstance();
    return inetAddressValidator.isValid(ip);
  }

  @Inject public  NetworkAddressValidator();

}