public static void injectToken(HttpURLConnection conn, Token token) {
    HttpCookie authCookie = token.cookieHandler.getAuthCookie();
    if (authCookie != null) {
      conn.addRequestProperty("Cookie", authCookie.toString());
    }
  }
@Test
  public void testInjectToken() throws Exception {
    HttpURLConnection conn = Mockito.mock(HttpURLConnection.class);
    AuthenticatedURL.Token token = new AuthenticatedURL.Token();
    token.set("foo");
    AuthenticatedURL.injectToken(conn, token);
    Mockito.verify(conn).addRequestProperty(Mockito.eq("Cookie"), Mockito.anyString());
  }