@Test public void testProcessURL() throws Exception { HttpURLConnection connection = createNiceMock(HttpURLConnection.class); AppCookieManager appCookieManager = createNiceMock(AppCookieManager.class); URLStreamProvider urlStreamProvider = createMockBuilder(URLStreamProvider.class). withConstructor(Integer.TYPE, Integer.TYPE, String.class, String.class, String.class). withArgs(1000, 1000, "path", "password", "type"). addMockedMethod("getAppCookieManager"). addMockedMethod("getConnection", String.class). createMock(); expect(urlStreamProvider.getAppCookieManager()).andReturn(appCookieManager).anyTimes(); expect(urlStreamProvider.getConnection("spec")).andReturn(connection); Map<String, List<String>> headerMap = new HashMap<String, List<String>>(); headerMap.put("Header1", Collections.singletonList("value")); headerMap.put("Cookie", Collections.singletonList("FOO=bar")); expect(appCookieManager.getCachedAppCookie("spec")).andReturn("APPCOOKIE=abcdef"); connection.setConnectTimeout(1000); connection.setReadTimeout(1000); connection.setRequestMethod("GET"); connection.setRequestProperty("Header1", "value"); connection.setRequestProperty("Cookie", "FOO=bar; APPCOOKIE=abcdef"); replay(urlStreamProvider, connection, appCookieManager); Assert.assertEquals(connection, urlStreamProvider.processURL("spec", "GET", (String) null, headerMap)); verify(urlStreamProvider, connection, appCookieManager); }
public HttpURLConnection processURL(String spec, String requestMethod, String body, Map<String, List<String>> headers) throws IOException { return processURL(spec, requestMethod, body == null ? null : body.getBytes(), headers); }
URLStreamProvider implements StreamProvider { public HttpURLConnection processURL(String spec, String requestMethod, String body, Map<String, List<String>> headers) throws IOException { return processURL(spec, requestMethod, body == null ? null : body.getBytes(), headers); } }
URLStreamProvider implements StreamProvider { public HttpURLConnection processURL(String spec, String requestMethod, String body, Map<String, List<String>> headers) throws IOException { return processURL(spec, requestMethod, body == null ? null : body.getBytes(), headers); } URLStreamProvider(int connectionTimeout, int readTimeout,
                           ComponentSSLConfiguration configuration);  URLStreamProvider(int connectionTimeout, int readTimeout, String trustStorePath,
                           String trustStorePassword, String trustStoreType); }
URLStreamProvider implements StreamProvider { public HttpURLConnection processURL(String spec, String requestMethod, String body, Map<String, List<String>> headers) throws IOException { return processURL(spec, requestMethod, body == null ? null : body.getBytes(), headers); } 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); }
URLStreamProvider implements StreamProvider { public HttpURLConnection processURL(String spec, String requestMethod, String body, Map<String, List<String>> headers) throws IOException { return processURL(spec, requestMethod, body == null ? null : body.getBytes(), headers); } 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; }