1 7 package org.jboss.test.remoting.callback.pull.memory.callbackstore; 8 9 import org.jboss.jrunit.extensions.ServerTestCase; 10 import org.jboss.remoting.InvokerLocator; 11 import org.jboss.remoting.callback.CallbackStore; 12 import org.jboss.remoting.callback.ServerInvokerCallbackHandler; 13 import org.jboss.remoting.transport.Connector; 14 import org.jboss.test.remoting.callback.pull.memory.CallbackInvocationHandler; 15 16 22 public class CallbackTestServer extends ServerTestCase 23 { 24 private static String transport = "socket"; 26 private static String host = "localhost"; 27 private static int port = 5412; 28 29 private String locatorURI = transport + "://" + host + ":" + port + "/?" + ServerInvokerCallbackHandler.CALLBACK_STORE_KEY + 30 "=" + CallbackStore.class.getName(); 31 32 private Connector connector; 33 34 private static final String RESPONSE_VALUE = "This is the return to SampleInvocationHandler invocation"; 36 37 38 public void setupServer() throws Exception 39 { 40 InvokerLocator locator = new InvokerLocator(locatorURI); 41 System.out.println("Starting remoting server with locator uri of: " + locatorURI); 42 connector = new Connector(); 43 connector.setInvokerLocator(locator.getLocatorURI()); 44 connector.start(); 45 46 CallbackInvocationHandler invocationHandler = new CallbackInvocationHandler(); 47 connector.addInvocationHandler("sample", invocationHandler); 49 } 50 51 public void setUp() throws Exception 52 { 53 setupServer(); 54 } 55 56 public void tearDown() throws Exception 57 { 58 if(connector != null) 59 { 60 connector.stop(); 61 connector.destroy(); 62 } 63 } 64 65 public static void main(String [] args) 66 { 67 CallbackTestServer server = new CallbackTestServer(); 68 try 69 { 70 server.setUp(); 71 Thread.currentThread().sleep(600000); 72 server.tearDown(); 73 } 74 catch(Exception e) 75 { 76 e.printStackTrace(); 77 } 78 } 79 80 } | Popular Tags |