org.amega.vnet.server
Class ProxyServer
java.lang.Object
|
+--org.amega.vnet.server.ProxyServer
- public class ProxyServer
- extends java.lang.Object
- implements Server, ConnectionStateListener
This class implements the 'proxy' server component of the
VNet server. The 'proxy' server let users create pseudo-direct
Connections between each other. Both users have a Connection
with the 'proxy' server but all data is forwarded in such a way
that it looks to the users that they have a direct Connection.
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
ProxyServer
public ProxyServer()
initServer
public boolean initServer(ENV env)
- Description copied from interface: Server
- Init this server component. The ENV instance given defines
the environment of the parent ServerControl instance.
Should return false if the server component failed to
initialize.
- Specified by:
- initServer in interface Server
getProxyLookup
public Lookup getProxyLookup()
- Returns a reference to the internal Lookup object
used to keep track of proxy Connections. This method
should only be used by GUI and the like to register
for update events and query for runtime data.
Consider the returned Lookup as read only.
handleConnect
public void handleConnect(Connection conn,
Message msg)
throws java.io.IOException
- Description copied from interface: Server
- This method is called by the ServerControl whenever
someone tries to log into (use) this server component.
'msg' is the first Message sent by the client.
'conn' is the Connection with the client. Note that it is the
responsibility of the server component to authenticate the user
(if needed) and to send a response to the first message sent by
the user. This will typically be a 'you logged in' or 'something
went wrong' message. The handleConnect method is allowed to throw
an IOException if an error related to communication with the
client ocurred. If this happens the Connection will be closed
by the ServerControl object calling the handleConnect method.
If an IOException was not thrown, closing the Connection is the
responsibility of the Server.
- Specified by:
- handleConnect in interface Server
handleCreateProxy
public void handleCreateProxy(Connection conn,
Message msg)
throws java.io.IOException
- Create a proxy Connection listening for a Connection from
a target user.
handleConnectProxy
public void handleConnectProxy(Connection conn,
Message msg)
throws java.io.IOException
- Connect to a proxy Connection that is listening.
stateChanged
public void stateChanged(ConnectionStateEvent evt)
- Handle proxy disconnect.
Only CONNECTION_CLOSED events should ever be delivered to this
method. The handleConnect method register this object as listener
to all proxy Connections. When a proxy Connection is closed, this
method is called and the proxy is removed from the runtime DB.
- Specified by:
- stateChanged in interface ConnectionStateListener