use of com.predic8.membrane.core.rules.ServiceProxy in project service-proxy by membrane.
the class ServiceInvocationTest method createServiceRule.
private ServiceProxy createServiceRule() {
ServiceProxy rule = new ServiceProxy(new ServiceProxyKey("localhost", "*", "*", 3012), "thomas-bayer.com", 80);
rule.setName("log");
rule.getInterceptors().add(new MockInterceptor("log"));
return rule;
}
use of com.predic8.membrane.core.rules.ServiceProxy in project service-proxy by membrane.
the class ResolverTest method setup.
@BeforeClass
public static void setup() throws Exception {
ServiceProxy sp = new ServiceProxy(new ServiceProxyKey(3029), "localhost", 8080);
sp.getInterceptors().add(new AbstractInterceptor() {
@Override
public Outcome handleRequest(Exchange exc) throws Exception {
hit = true;
return Outcome.CONTINUE;
}
});
WebServerInterceptor i = new WebServerInterceptor();
if (deployment.equals(STANDALONE))
i.setDocBase("src/test/resources");
else {
i.setDocBase("/test");
router.getResolverMap().addSchemaResolver(resolverMap.getFileSchemaResolver());
}
sp.getInterceptors().add(i);
router.add(sp);
router.init();
}
use of com.predic8.membrane.core.rules.ServiceProxy in project service-proxy by membrane.
the class ConnectionTest method setUp.
@Before
public void setUp() throws Exception {
Rule rule2000 = new ServiceProxy(new ServiceProxyKey("localhost", "*", ".*", 2000), "predic8.com", 80);
router = new HttpRouter();
router.getRuleManager().addProxyAndOpenPortIfNew(rule2000);
conLocalhost = Connection.open("localhost", 2000, null, null, 30000);
con127_0_0_1 = Connection.open("127.0.0.1", 2000, null, null, 30000);
}
use of com.predic8.membrane.core.rules.ServiceProxy in project service-proxy by membrane.
the class IllegalCharactersInURLTest method init.
@Before
public void init() throws Exception {
r = new HttpRouter();
r.setHotDeploy(false);
r.add(new ServiceProxy(new ServiceProxyKey(3027), "localhost", 3028));
ServiceProxy sp2 = new ServiceProxy(new ServiceProxyKey(3028), null, 80);
sp2.getInterceptors().add(new AbstractInterceptor() {
@Override
public Outcome handleRequest(Exchange exc) throws Exception {
Assert.assertEquals("/foo{}", exc.getRequestURI());
exc.setResponse(Response.ok().build());
return Outcome.RETURN;
}
});
r.add(sp2);
r.start();
}
use of com.predic8.membrane.core.rules.ServiceProxy in project service-proxy by membrane.
the class EmbeddingJava method main.
public static void main(String[] args) throws Exception {
String hostname = "*";
String method = "GET";
String path = ".*";
int listenPort = 4000;
ServiceProxyKey key = new ServiceProxyKey(hostname, method, path, listenPort);
String targetHost = "predic8.com";
int targetPort = 80;
ServiceProxy sp = new ServiceProxy(key, targetHost, targetPort);
sp.getInterceptors().add(new AddMyHeaderInterceptor());
HttpRouter router = new HttpRouter();
router.add(sp);
router.init();
}
Aggregations