2
* JBoss, Home of Professional Open Source
4
* Distributable under LGPL license.
5
* See terms of license at gnu.org.
7
package org.jboss.test.remoting.lease.socket;
9
import org.jboss.jrunit.extensions.ServerTestCase;
10
import org.jboss.logging.Logger;
11
import org.jboss.remoting.transport.Connector;
12
import org.jboss.remoting.ConnectionListener;
13
import org.jboss.remoting.Client;
16
* @author <a href="mailto:ovidiu@jboss.org">Ovidiu Feodorov</a>
17
* @version <tt>$Revision: 2171 $</tt>
18
* $Id: ClientLeasePeriodTestServer.java 2171 2007-02-16 05:09:03Z rsigal $
20
public class ClientLeasePeriodTestServer extends ServerTestCase
22
// Constants ------------------------------------------------------------------------------------
24
public static String locatorURINoLease = "socket://localhost:9900";
25
public static String locatorURILease = "socket://localhost:9909";
26
protected static Logger log = Logger.getLogger(ClientLeasePeriodTestServer.class);
28
// Static ---------------------------------------------------------------------------------------
30
public static void main(String[] args)
34
ClientLeasePeriodTestServer server = new ClientLeasePeriodTestServer();
46
// Attributes -----------------------------------------------------------------------------------
48
private Connector connectorNoLease;
49
private Connector connectorLease;
50
private ConnectionListener connectionListener;
52
// Constructors ---------------------------------------------------------------------------------
54
// Public ---------------------------------------------------------------------------------------
56
// Package protected ----------------------------------------------------------------------------
58
// Protected ------------------------------------------------------------------------------------
60
protected void setUp() throws Exception
62
connectorNoLease = new Connector(ClientLeasePeriodTestServer.locatorURINoLease);
63
connectorNoLease.create();
64
connectorNoLease.start();
66
connectorLease = new Connector(ClientLeasePeriodTestServer.locatorURILease);
67
connectorLease.create();
68
connectorLease.start();
70
connectionListener = new ConnectionListener()
72
public void handleConnectionException(Throwable throwable, Client client)
78
connectorLease.addConnectionListener(connectionListener);
83
protected void tearDown() throws Exception
85
if(connectorLease != null)
87
connectorLease.removeConnectionListener(connectionListener);
88
connectorLease.stop();
89
connectorLease.destroy();
92
if(connectorNoLease != null)
94
connectorNoLease.stop();
95
connectorNoLease.destroy();
101
// Private --------------------------------------------------------------------------------------
103
// Inner classes --------------------------------------------------------------------------------