@Test public void testNotMatchUrl() throws IOException, InterruptedException { URL flashbackScene = getClass().getResource(FLASHBACK_SCENE_DIR); String rootPath = flashbackScene.getPath(); SceneConfiguration sceneConfiguration = new SceneConfiguration(rootPath, SCENE_MODE, HTTP_SCENE); 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); HttpResponse httpResponse = client.execute(request); Assert.assertEquals(httpResponse.getStatusLine().getStatusCode(), 400); Assert.assertTrue(EntityUtils.toString(httpResponse.getEntity()) .contains("No Matching Request")); url = "http: request = new HttpGet(url); request.addHeader("a", "b"); httpResponse = client.execute(request); Assert.assertEquals(httpResponse.getStatusLine().getStatusCode(), 400); Assert.assertTrue(EntityUtils.toString(httpResponse.getEntity()) .contains("No Matching Request")); } }
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();  }