1 7 package org.jboss.test.remoting.marshall.dynamic.remote.socket; 8 9 import javax.management.MBeanServer ; 10 import org.jboss.jrunit.extensions.ServerTestCase; 11 import org.jboss.remoting.InvocationRequest; 12 import org.jboss.remoting.InvokerLocator; 13 import org.jboss.remoting.ServerInvocationHandler; 14 import org.jboss.remoting.ServerInvoker; 15 import org.jboss.remoting.callback.InvokerCallbackHandler; 16 import org.jboss.remoting.transport.Connector; 17 18 24 public class MarshallerLoadingServer extends ServerTestCase implements MarshallerLoadingConstants 25 { 26 private Connector connector; 27 28 private static final String RESPONSE_VALUE = "This is the return to SampleInvocationHandler invocation"; 30 31 public void setupServer() throws Exception 32 { 33 System.out.println("locatorURI: " + locatorURI); 34 InvokerLocator locator = new InvokerLocator(locatorURI); 35 System.out.println("Starting remoting server with locator uri of: " + locatorURI); 36 connector = new Connector(); 37 connector.setInvokerLocator(locator.getLocatorURI()); 38 connector.start(); 39 40 SampleInvocationHandler invocationHandler = new SampleInvocationHandler(); 41 connector.addInvocationHandler("sample", invocationHandler); 43 } 44 45 public void setUp() throws Exception 46 { 47 setupServer(); 48 } 49 50 public void tearDown() throws Exception 51 { 52 if(connector != null) 53 { 54 connector.stop(); 55 connector.destroy(); 56 } 57 } 58 59 60 63 public static class SampleInvocationHandler implements ServerInvocationHandler 64 { 65 72 public Object invoke(InvocationRequest invocation) throws Throwable 73 { 74 System.out.println("Invocation request is: " + invocation.getParameter()); 76 77 return RESPONSE_VALUE; 79 } 80 81 87 public void addListener(InvokerCallbackHandler callbackHandler) 88 { 89 } 91 92 98 public void removeListener(InvokerCallbackHandler callbackHandler) 99 { 100 } 102 103 108 public void setMBeanServer(MBeanServer server) 109 { 110 } 112 113 118 public void setInvoker(ServerInvoker invoker) 119 { 120 } 122 123 } 124 } | Popular Tags |