Exemplo n.º 1
0
 @Override
 public void start(String tapeName, Map arguments) {
   if (interceptor == null) {
     try {
       interceptor = new ProxyServer(this);
     } catch (UnknownHostException e) {
       throw new RuntimeException("Unable to start proxy", e);
     }
   }
   if (!interceptor.isRunning()) {
     interceptor.start();
   }
   super.start(tapeName, arguments);
 }
Exemplo n.º 2
0
 @Override
 public void stop() {
   interceptor.stop();
   super.stop();
 }
Exemplo n.º 3
0
 /** @return a `java.net.Proxy` instance configured to point to the Betamax proxy. */
 public Proxy getProxy() {
   return new Proxy(
       Proxy.Type.HTTP, new InetSocketAddress(interceptor.getHost(), interceptor.getPort()));
 }
Exemplo n.º 4
0
 /** @return the hostname or address where the proxy will run. */
 public String getProxyHost() {
   return interceptor.getHost();
 }