lilypad.client.connect.api
Interface Connect


public interface Connect


Method Summary
 void close()
          Close to not allow for anymore connections nor disconnections.
 void connect()
          Connect the server to it's network.
 void disconnect()
          Disconnect the server from it's network.
 ConnectSettings getSettings()
           
 boolean isClosed()
           
 boolean isConnected()
           
 void registerMessageEventListener(MessageEventListener messageEventListener)
          Register a MessageEventListener to receive an events when a message has been received by this specific session.
 void registerRedirectEventListener(RedirectEventListener redirectEventListener)
          Register a RedirectEventListener to receive an events when a redirect is to be handled by this specific session, only used when the session's role is that of a proxy.
 void registerServerEventListener(ServerEventListener serverEventListener)
          Register a ServerEventListener to receive an events when a server has been added or removed from the network, only used when the session's role is that of a proxy.
<T extends Result>
FutureResult<T>
request(Request<T> request)
          Pass a request to be completed and given a result by the network.
 void unregisterMessageEventListener(MessageEventListener messageEventListener)
          Unregister a MessageEventListener to exclude from receiving events when a message has been received by this specific session.
 void unregisterRedirectEventListener(RedirectEventListener redirectEventListener)
          Unregister a RedirectEventListener to exclude from receiving events when a redirect is to be handled by this specific session.
 void unregisterServerEventListener(ServerEventListener serverEventListener)
          Unregister a ServerEventListener to exclude from receiving events when a server has been added or removed from the network.
 

Method Detail

connect

void connect()
             throws java.lang.Throwable
Connect the server to it's network.

Throws:
java.lang.Throwable - showing the connection failed

disconnect

void disconnect()
Disconnect the server from it's network.


close

void close()
Close to not allow for anymore connections nor disconnections.


request

<T extends Result> FutureResult<T> request(Request<T> request)
                                       throws RequestException
Pass a request to be completed and given a result by the network.

Parameters:
request -
Returns:
the FutureResult to show that the request will be completed in the future
Throws:
RequestException - if the request failed

registerMessageEventListener

void registerMessageEventListener(MessageEventListener messageEventListener)
Register a MessageEventListener to receive an events when a message has been received by this specific session.

Parameters:
messageEventListener -

unregisterMessageEventListener

void unregisterMessageEventListener(MessageEventListener messageEventListener)
Unregister a MessageEventListener to exclude from receiving events when a message has been received by this specific session.

Parameters:
messageEventListener -

registerRedirectEventListener

void registerRedirectEventListener(RedirectEventListener redirectEventListener)
Register a RedirectEventListener to receive an events when a redirect is to be handled by this specific session, only used when the session's role is that of a proxy.

Parameters:
redirectEventListener -

unregisterRedirectEventListener

void unregisterRedirectEventListener(RedirectEventListener redirectEventListener)
Unregister a RedirectEventListener to exclude from receiving events when a redirect is to be handled by this specific session.

Parameters:
redirectEventListener -

registerServerEventListener

void registerServerEventListener(ServerEventListener serverEventListener)
Register a ServerEventListener to receive an events when a server has been added or removed from the network, only used when the session's role is that of a proxy.

Parameters:
serverEventListener -

unregisterServerEventListener

void unregisterServerEventListener(ServerEventListener serverEventListener)
Unregister a ServerEventListener to exclude from receiving events when a server has been added or removed from the network.

Parameters:
serverEventListener -

isConnected

boolean isConnected()
Returns:
if this session is connected

isClosed

boolean isClosed()
Returns:
if this session is closed

getSettings

ConnectSettings getSettings()
Returns:
the settings, not guaranteed to be an accurate representation