~ubuntu-branches/ubuntu/raring/libjboss-remoting-java/raring

« back to all changes in this revision

Viewing changes to tests/org/jboss/test/remoting/transport/socket/connection/retry/SocketRetryServer.java

  • Committer: Package Import Robot
  • Author(s): Torsten Werner
  • Date: 2011-09-09 14:01:03 UTC
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: package-import@ubuntu.com-20110909140103-o8ucrolqt5g25k57
Tags: upstream-2.5.3.SP1
ImportĀ upstreamĀ versionĀ 2.5.3.SP1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package org.jboss.test.remoting.transport.socket.connection.retry;
2
 
 
3
 
import org.jboss.jrunit.extensions.ServerTestCase;
4
 
import org.jboss.remoting.InvocationRequest;
5
 
import org.jboss.remoting.ServerInvocationHandler;
6
 
import org.jboss.remoting.ServerInvoker;
7
 
import org.jboss.remoting.callback.InvokerCallbackHandler;
8
 
import org.jboss.remoting.transport.Connector;
9
 
import org.jboss.remoting.transport.socket.SocketClientInvoker;
10
 
import org.jboss.remoting.transport.socket.SocketServerInvoker;
11
 
 
12
 
import javax.management.MBeanServer;
13
 
 
14
 
/**
15
 
 * @author <a href="mailto:tom.elrod@jboss.com">Tom Elrod</a>
16
 
 */
17
 
public class SocketRetryServer extends ServerTestCase
18
 
{
19
 
   private Connector connector = null;
20
 
 
21
 
 
22
 
   public void setUp() throws Exception
23
 
   {
24
 
      String locatorUri = getTransport() + "://localhost:" + getPort() + "/?" + SocketClientInvoker.SO_TIMEOUT_FLAG + "=" + 1000 + "&" +
25
 
                          SocketServerInvoker.CHECK_CONNECTION_KEY + "=" + Boolean.FALSE;
26
 
 
27
 
      connector = new Connector(locatorUri);
28
 
      connector.create();
29
 
      connector.addInvocationHandler("test", new TestInvocationHandler());
30
 
      connector.start();
31
 
 
32
 
   }
33
 
 
34
 
   public void tearDown()
35
 
   {
36
 
      if (connector != null)
37
 
      {
38
 
         connector.stop();
39
 
         connector.destroy();
40
 
      }
41
 
   }
42
 
 
43
 
   public static void main(String[] args)
44
 
   {
45
 
      SocketRetryServer server = new SocketRetryServer();
46
 
      try
47
 
      {
48
 
         server.setUp();
49
 
 
50
 
         Thread.sleep(600000);
51
 
      }
52
 
      catch (Exception e)
53
 
      {
54
 
         e.printStackTrace();
55
 
      }
56
 
      finally
57
 
      {
58
 
         server.tearDown();
59
 
      }
60
 
   }
61
 
 
62
 
   protected String getTransport()
63
 
   {
64
 
      return "socket";
65
 
   }
66
 
   
67
 
   protected int getPort()
68
 
   {
69
 
      return 8888;
70
 
   }
71
 
   
72
 
   public class TestInvocationHandler implements ServerInvocationHandler
73
 
   {
74
 
 
75
 
      public void setMBeanServer(MBeanServer server)
76
 
      {
77
 
         //TODO: -TME Implement
78
 
      }
79
 
 
80
 
      public void setInvoker(ServerInvoker invoker)
81
 
      {
82
 
         //TODO: -TME Implement
83
 
      }
84
 
 
85
 
      public Object invoke(InvocationRequest invocation) throws Throwable
86
 
      {
87
 
         return "barfoo";
88
 
      }
89
 
 
90
 
      public void addListener(InvokerCallbackHandler callbackHandler)
91
 
      {
92
 
         //TODO: -TME Implement
93
 
      }
94
 
 
95
 
      public void removeListener(InvokerCallbackHandler callbackHandler)
96
 
      {
97
 
         //TODO: -TME Implement
98
 
      }
99
 
   }
100
 
}