2
* JBoss, Home of Professional Open Source
3
* Copyright 2005, JBoss Inc., and individual contributors as indicated
4
* by the @authors tag. See the copyright.txt in the distribution for a
5
* full listing of individual contributors.
7
* This is free software; you can redistribute it and/or modify it
8
* under the terms of the GNU Lesser General Public License as
9
* published by the Free Software Foundation; either version 2.1 of
10
* the License, or (at your option) any later version.
12
* This software is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with this software; if not, write to the Free
19
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
23
package org.jboss.test.remoting.transport.socket.timeout;
25
import org.jboss.jrunit.extensions.ServerTestCase;
26
import org.jboss.remoting.InvocationRequest;
27
import org.jboss.remoting.InvokerLocator;
28
import org.jboss.remoting.ServerInvocationHandler;
29
import org.jboss.remoting.ServerInvoker;
30
import org.jboss.remoting.callback.InvokerCallbackHandler;
31
import org.jboss.remoting.transport.Connector;
33
import javax.management.MBeanServer;
34
import java.util.HashMap;
38
* @author <a href="mailto:tom.elrod@jboss.com">Tom Elrod</a>
40
public class TimeoutServerTest extends ServerTestCase
42
// private String locatorURI = "socket://localhost:8899/?timeout=3000";
43
// private String locatorURI = "socket://localhost:8899";
44
private Connector connector = null;
46
protected String getTransport()
51
public void setUp() throws Exception
53
Map config = new HashMap();
54
config.put("timeout", "3000");
55
String locatorURI = getTransport() + "://localhost:8899";
56
InvokerLocator locator = new InvokerLocator(locatorURI);
57
connector = new Connector(locator, config);
59
connector.addInvocationHandler("test", new TimeoutHandler());
63
protected void tearDown() throws Exception
72
public static void main(String[] args)
74
TimeoutServerTest server = new TimeoutServerTest();
85
private class TimeoutHandler implements ServerInvocationHandler
89
* set the mbean server that the handler can reference
93
public void setMBeanServer(MBeanServer server)
95
//TODO: -TME Implement
99
* set the invoker that owns this handler
103
public void setInvoker(ServerInvoker invoker)
105
//TODO: -TME Implement
109
* called to handle a specific invocation. Please take care to make sure
110
* implementations are thread safe and can, and often will, receive concurrent
111
* calls on this method.
117
public Object invoke(InvocationRequest invocation) throws Throwable
119
Object obj = invocation.getParameter();
120
if(obj instanceof String && "timeout".equals(obj))
122
Thread.currentThread().sleep(30000);
124
return null; //TODO: -TME Implement
128
* Adds a callback handler that will listen for callbacks from
129
* the server invoker handler.
131
* @param callbackHandler
133
public void addListener(InvokerCallbackHandler callbackHandler)
135
//TODO: -TME Implement
139
* Removes the callback handler that was listening for callbacks
140
* from the server invoker handler.
142
* @param callbackHandler
144
public void removeListener(InvokerCallbackHandler callbackHandler)
146
//TODO: -TME Implement
b'\\ No newline at end of file'