### Question:
HttpConnection implements Connection { public Connection cookie(String name, String value) { req.cookie(name, value); return this; } private  HttpConnection(); static Connection connect(String url); static Connection connect(URL url); Connection url(URL url); Connection url(String url); Connection userAgent(String userAgent); Connection timeout(int millis); Connection followRedirects(boolean followRedirects); Connection referrer(String referrer); Connection method(Method method); Connection ignoreHttpErrors(boolean ignoreHttpErrors); Connection ignoreContentType(boolean ignoreContentType); Connection data(String key, String value); Connection data(Map<String, String> data); Connection data(String... keyvals); Connection header(String name, String value); Connection cookie(String name, String value); Document get(); Document post(); Connection.Response execute(); Connection.Request request(); Connection request(Connection.Request request); Connection.Response response(); Connection response(Connection.Response response);  }### Answer:
@Test public void ignoresEmptyCookieNameAndVals() { Map<String, List<String>> headers = new HashMap<String, List<String>>(); List<String> cookieStrings = new ArrayList<String>(); cookieStrings.add(null); cookieStrings.add(""); cookieStrings.add("one"); cookieStrings.add("two="); cookieStrings.add("three=;"); cookieStrings.add("four=data; Domain=.example.com; Path=/"); headers.put("Set-Cookie", cookieStrings); HttpConnection.Response res = new HttpConnection.Response(); res.processResponseHeaders(headers); assertEquals(4, res.cookies().size()); assertEquals("", res.cookie("one")); assertEquals("", res.cookie("two")); assertEquals("", res.cookie("three")); assertEquals("data", res.cookie("four")); }
@Test public void cookie() { Connection con = HttpConnection.connect("http: con.cookie("Name", "Val"); assertEquals("Val", con.request().cookie("Name")); }