org.sonatype.tests.http.server.fluent
Class Proxy

java.lang.Object
  extended by org.sonatype.tests.http.server.fluent.Server
      extended by org.sonatype.tests.http.server.fluent.Proxy

public class Proxy
extends Server

This is not a real proxy. It supports proxy connections and auth, but will not forward requests to the requested URL. It will resolve the requested path against the behaviors set for the proxy instance.

Example:

     Server proxy = Proxy.withPort(0).start();
     proxy.serve( "/*" ).withBehaviours( redirect( "/other/url" ) );
     proxy.serve( "/other/*" ).withBehaviours( content( "test" ) );
     setProxy("localhost", proxy.getPort() );
     assertThat( get( "http://invalid.url/foo" ), is ( "test" ) );
 


Constructor Summary
Proxy(JettyProxyProvider serverProvider)
           
 
Method Summary
static Server withPort(int port)
           
 
Methods inherited from class org.sonatype.tests.http.server.fluent.Server
getPort, getUrl, serve, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Proxy

public Proxy(JettyProxyProvider serverProvider)
Method Detail

withPort

public static Server withPort(int port)
                       throws Exception
Throws:
Exception


Copyright © 2010-2013 Sonatype, Inc.. All Rights Reserved.