Package com.caucho.hessian.client

Examples of com.caucho.hessian.client.HessianProxyFactory.create()


        final ClassLoader loader = Thread.currentThread().getContextClassLoader();
        final HessianProxyFactory clientFactory = new HessianProxyFactory(loader);
        final SerializerFactory factory = new SerializerFactory(loader);
        factory.setAllowNonSerializable(true);
        clientFactory.setSerializerFactory(factory);
        final CdiService client = CdiService.class.cast(clientFactory.create(CdiService.class, "http://127.0.0.1:4204/web/hessian/service"));

        final Out out = client.call(new In("test"));
        assertThat(out, instanceOf(Out.class));
        assertEquals("test", out.value);
    }
View Full Code Here


        final ClassLoader loader = Thread.currentThread().getContextClassLoader();
        final HessianProxyFactory clientFactory = new HessianProxyFactory(loader);
        final SerializerFactory factory = new SerializerFactory(loader);
        factory.setAllowNonSerializable(true);
        clientFactory.setSerializerFactory(factory);
        final CdiService client = CdiService.class.cast(clientFactory.create(CdiService.class, "http://127.0.0.1:4204/web/hessian/foo"));

        final Out out = client.call(new In("test"));
        assertThat(out, instanceOf(Out.class));
        assertEquals("test", out.value);
    }
View Full Code Here

            throw new IllegalStateException("Unsupported http protocol client=\"" + client + "\"!");
        }
        int timeout = url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT);
        hessianProxyFactory.setConnectTimeout(timeout);
        hessianProxyFactory.setReadTimeout(timeout);
        return (T) hessianProxyFactory.create(serviceType, url.setProtocol("http").toJavaURL(), Thread.currentThread().getContextClassLoader());
    }

    protected int getErrorCode(Throwable e) {
        if (e instanceof HessianConnectionException) {
            if (e.getCause() != null) {
View Full Code Here

public class SMSEngineServiceWorkTest {

    public static void main(String[] args) throws Exception {
        HessianProxyFactory factory = new HessianProxyFactory();
        SMSEngine engine = (SMSEngine) factory.create(SMSEngine.class, "http://localhost:9292/sms-engine/service");
        try {
            engine.sendSMS("79053673205", "sms sending test");
            System.out.println("sms sent");
            engine.sendSMS("79053673205", "sms sending test");
            System.out.println("sms sent");
View Full Code Here

    factory.setUser("client1");
    factory.setPassword("client1");
    factory.setDebug(true);
    factory.setOverloadEnabled(true);
    // factory.setReadTimeout(100);
    final Hello basic = (Hello) factory.create(Hello.class, url);
    // 测试方法重载
    System.out.println(basic.hello("郭蕾"));
  }
}
View Full Code Here

    factory.setDebug(true);
    factory.setOverloadEnabled(true);
    // factory.setConnectTimeout(timeout);

    // factory.setReadTimeout(100);
    final Hello basic = (Hello) factory.create(Hello.class, url);

    // System.out.println("SayHello:" + basic.hello("guolei"));
    // System.out.println("SayHello:" + basic.test());
    // System.out.println(basic.getAppSecret("11"));
    // User user = basic.getUser(1);
View Full Code Here

  @Before
  public void setup() throws MalformedURLException {
    String port = System.getProperty("org_onebusaway_test_port", "8080");
    HessianProxyFactory factory = new HessianProxyFactory();
    _service = (FederatedServiceRegistry) factory.create(
        FederatedServiceRegistry.class, "http://localhost:" + port
            + "/onebusaway-federations-webapp/remoting/service-registry");
  }

  @After
View Full Code Here

public class Hessian {
  @SuppressWarnings("unchecked")
  public static <T> T connect(String serviceUrl, Class<T> serviceInterface) {
    HessianProxyFactory factory = new HessianProxyFactory();
    try {
      return (T) factory.create(serviceInterface, serviceUrl);
    } catch (MalformedURLException e) {
      throw new RuntimeException(e);
    }
  }
}
View Full Code Here

  {
    if (_jmxProxy == null) {
      try {
  HessianProxyFactory proxy = new HessianProxyFactory();
  proxy.getSerializerFactory().addFactory(new JMXSerializerFactory());
  _jmxProxy = (RemoteJMX) proxy.create(_url);
      } catch (Exception e) {
  throw new RuntimeException(e);
      }
    }
View Full Code Here

  {
    if (_jmxProxy == null) {
      try {
        HessianProxyFactory proxy = new HessianProxyFactory();
        proxy.getSerializerFactory().addFactory(new JMXSerializerFactory());
        _jmxProxy = (RemoteJMX) proxy.create(_url);
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.