URLStreamProvider implements StreamProvider { public static String appendCookie(String cookies, String newCookie) { if (cookies == null || cookies.length() == 0) { return newCookie; } return cookies + "; " + newCookie; } URLStreamProvider(int connectionTimeout, int readTimeout,
                           ComponentSSLConfiguration configuration);  URLStreamProvider(int connectionTimeout, int readTimeout, String trustStorePath,
                           String trustStorePassword, String trustStoreType); void setSetupTruststoreForHttps(boolean setupTruststoreForHttps); boolean getSetupTruststoreForHttps(); @Override InputStream readFrom(String spec, String requestMethod, String params); @Override InputStream readFrom(String spec); HttpURLConnection processURL(String spec, String requestMethod, String body, Map<String, List<String>> headers); HttpURLConnection processURL(String spec, String requestMethod, InputStream body, Map<String, List<String>> headers); HttpURLConnection processURL(String spec, String requestMethod, byte[] body, Map<String, List<String>> headers); synchronized AppCookieManager getAppCookieManager(); static String appendCookie(String cookies, String newCookie); static final String COOKIE; }
@Test public void testAppendCookie() throws Exception { Assert.assertEquals("newCookie", URLStreamProvider.appendCookie(null, "newCookie")); Assert.assertEquals("newCookie", URLStreamProvider.appendCookie("", "newCookie")); Assert.assertEquals("oldCookie; newCookie", URLStreamProvider.appendCookie("oldCookie", "newCookie")); Assert.assertEquals("oldCookie1; oldCookie2; newCookie", URLStreamProvider.appendCookie("oldCookie1; oldCookie2", "newCookie")); }