@Test public void testSetCookieHeader() throws IOException, InterruptedException { URL flashbackScene = getClass().getResource(FLASHBACK_SCENE_DIR); String rootPath = flashbackScene.getPath(); SceneConfiguration sceneConfiguration = new SceneConfiguration(rootPath, SCENE_MODE, "setCookie"); try (FlashbackRunner flashbackRunner = new FlashbackRunner.Builder().mode(SCENE_MODE) .sceneAccessLayer( new SceneAccessLayer(SceneFactory.create(sceneConfiguration), MatchRuleUtils.matchEntireRequest())) .build()) { flashbackRunner.start(); HttpHost host = new HttpHost(PROXY_HOST, PROXY_PORT); String url = "http: HttpClient client = HttpClientBuilder.create().setProxy(host).build(); HttpGet request = new HttpGet(url); request.addHeader("Set-Cookie", "ABC=\\\"R:0|g:fcaa967e-asdfa-484a-8a5e-asdfa\\\"; Version=1; Max-Age=30; Expires=Thu, 23-Mar-2017 18:01:20 GMT; Path=/"); request.addHeader("Set-Cookie", "ABC=\\\"R:0|g:fcaa967e-asdfasdf-484a-8a5e-asdf|n:asdfasdfasd-37ca-42cf-a909-95e0dd19e334\\\"; Version=1; Max-Age=30; Expires=Thu, 23-Mar-2017 18:01:20 GMT; Path=/"); request.addHeader("Set-Cookie", "ABC=\\\"R:0|i:138507\\\"; Version=1; Max-Age=30; Expires=Thu, 23-Mar-2017 18:01:20 GMT; Path=/"); request.addHeader("Set-Cookie", "ABC=\\\"R:0|i:138507|e:42\\\"; Version=1; Max-Age=30; Expires=Thu, 23-Mar-2017 18:01:20 GMT; Path=/"); request.addHeader("Set-Cookie", "guestidc=0d28bda6-5d42-4ee9-bd1e-asdasda; Domain=asdafsdfasdfasdfa.com; Path=/"); HttpResponse httpResponse0 = client.execute(request); String strEnt = EntityUtils.toString(httpResponse0.getEntity()); Assert.assertTrue(strEnt .contains("I am from Flashback scene, not http: } }
public void start() throws InterruptedException { _proxyServer.start(); _running = true; }
FlashbackRunner implements AutoCloseable { public void start() throws InterruptedException { _proxyServer.start(); _running = true; } }
FlashbackRunner implements AutoCloseable { public void start() throws InterruptedException { _proxyServer.start(); _running = true; } private  FlashbackRunner(final Builder builder); }
FlashbackRunner implements AutoCloseable { public void start() throws InterruptedException { _proxyServer.start(); _running = true; } private  FlashbackRunner(final Builder builder); void start(); void stop(); void setScene(Scene scene); void setMatchRule(MatchRule matchRule); @Override void close(); }
FlashbackRunner implements AutoCloseable { public void start() throws InterruptedException { _proxyServer.start(); _running = true; } private  FlashbackRunner(final Builder builder); void start(); void stop(); void setScene(Scene scene); void setMatchRule(MatchRule matchRule); @Override void close();  }