use of com.predic8.membrane.core.rules.ServiceProxyKey in project service-proxy by membrane.
the class ViaProxyTest method setUp.
@Before
public void setUp() throws Exception {
ProxyConfiguration proxy = new ProxyConfiguration();
proxy.setHost("localhost");
proxy.setPort(3128);
proxyRouter = new HttpRouter(proxy);
proxyRouter.getRuleManager().addProxy(new ProxyRule(new ProxyRuleKey(3128)), RuleDefinitionSource.MANUAL);
proxyRouter.init();
router = new HttpRouter();
router.getRuleManager().addProxyAndOpenPortIfNew(new ServiceProxy(new ServiceProxyKey("localhost", "POST", ".*", 4000), "thomas-bayer.com", 80));
router.init();
}
use of com.predic8.membrane.core.rules.ServiceProxyKey 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.ServiceProxyKey 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.ServiceProxyKey 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.ServiceProxyKey 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();
}
Aggregations