/** * Creates a Server that will utilize both reliable and fast * transports to communicate with clients. The specified port * will be used for both TCP and UDP communication. */ public static Server createServer( int tcpPort, int udpPort ) throws IOException { return createServer( DEFAULT_GAME_NAME, DEFAULT_VERSION, tcpPort, udpPort ); }
protected void fireConnected() { for( ClientStateListener l : stateListeners ) { l.clientConnected( this ); } }
/** * Creates a client that can be connected at a later time. */ public static NetworkClient createClient() { return createClient( DEFAULT_GAME_NAME, DEFAULT_VERSION ); }
public ObjectStore(Server server) { this.server = server; server.addMessageListener(serverEventHandler, RemoteObjectDefMessage.class, RemoteMethodCallMessage.class, RemoteMethodReturnMessage.class); server.addConnectionListener(serverEventHandler); }
/** * Creates a Client that communicates with the specified host and port * using both reliable and fast transports. */ public static Client connectToServer( String host, int hostPort ) throws IOException { return connectToServer( DEFAULT_GAME_NAME, DEFAULT_VERSION, host, hostPort, hostPort ); }
/** * Returns the RMI registry for the specific HostedConnection. Each connection * has its own registry with its own connection-specific shared objects. */ public RmiRegistry getRmiRegistry( HostedConnection hc ) { return hc.getAttribute(ATTRIBUTE_NAME); }
protected void fireConnectionRemoved( HostedConnection conn ) { for( ConnectionListener l : connectionListeners ) { l.connectionRemoved( this, conn ); } }
public boolean apply( T input ) { return !delegate.apply(input); } }
protected void fireDisconnected( DisconnectInfo info ) { for( ClientStateListener l : stateListeners ) { l.clientDisconnected( this, info ); } }
/** * Creates a client that can be connected at a later time. The specified * game name and version must match the server or the client will be turned * away. */ public static NetworkClient createClient( String gameName, int version ) { return new NetworkClientImpl(gameName, version); }
protected void fireConnectionAdded( HostedConnection conn ) { for( ConnectionListener l : connectionListeners ) { l.connectionAdded( this, conn ); } }
/** * Creates a filter that returns true for inputs that are .equals() * equivalent to the specified value. */ public static <T> Filter<T> equalTo( T value ) { return new EqualToFilter<T>(value); }
/** * Creates a filter that returns true for any value in the specified * collection and false for all other cases. */ public static <T> Filter<T> in( Collection<? extends T> collection ) { return new InFilter<T>(collection); }
/** * Creates a filter that returns true when the specified delegate filter * returns false, and vice versa. */ public static <T> Filter<T> not( Filter<T> f ) { return new NotFilter<T>(f); }
public synchronized void start() { if( isRunning ) { return; } server.start(); isRunning = true; }
/** * Retrieves the RpcConnection for the specified HostedConnection * if that HostedConnection has had RPC services started using * startHostingOnConnection() (or via autohosting). Returns null * if the connection currently doesn't have RPC hosting services * attached. */ public RpcConnection getRpcConnection( HostedConnection hc ) { return hc.getAttribute(ATTRIBUTE_NAME); }