code: public static void setRequestProperties(final Properties props, HttpURLConnection conn, Integer timeout) {
          if (props != null) {
              if (props.get("User-Agent") == null) {
                  conn.setRequestProperty("User-Agent", "Java");
              }
  
              for (Entry entry : props.entrySet()) {
                  conn.setRequestProperty(String.valueOf(entry.getKey()), String.valueOf(entry.getValue()));
              }
          }
  
          if (timeout != null) {
              conn.setConnectTimeout(timeout * 1000);
          }
  
      }
docs: Sets request headers for an http connection
  
  @param props properties to be sent
  @param conn the connection
  @param timeout the connection timeout