title: Add HttpCookie to CookieStore
body: <p>I need to add a few cookies to authorize on website. Cookies are added successfully, but they are missing when making a request:</p>
  
  <pre><code>import java.io.*;
  import java.net.*;
  
  public class Main {
      static public void main(String[] args) throws Exception {
          CookieManager cookieManager = new CookieManager(null, CookiePolicy.ACCEPT_ALL);
          CookieStore cookieJar = cookieManager.getCookieStore();
          CookieHandler.setDefault(cookieManager);
  
          HttpCookie cookie = new HttpCookie("name123", "value123");
          cookieJar.add(new URI("http://httpbin.org"), cookie);
  
          HttpURLConnection connection = (HttpURLConnection) new URL("http://httpbin.org/cookies").openConnection();
          connection.setRequestMethod("GET");
          connection.connect();
  
          BufferedReader in;
          StringBuilder response = new StringBuilder();
          String inputLine;
          in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
          while ((inputLine = in.readLine()) != null) {
              response.append(inputLine);
          }
          in.close();
          System.out.println(response.toString());
      }
  }
  </code></pre>
  
  <p>But I only get an empty map of cookies in response</p>
  
  <pre><code>{  "cookies": {}}
  </code></pre>
  
  <p>Please, tell me what I should do to fix it.</p>