use of games.strategy.engine.message.RemoteMethodCall in project triplea by triplea-game.
the class ServerMessenger method bareBonesSendChatMessage.
private void bareBonesSendChatMessage(final String message, final INode to) {
final RemoteName rn = new RemoteName(isLobby() ? ChatController.getChatChannelName("_LOBBY_CHAT") : ChatController.getChatChannelName("games.strategy.engine.framework.ui.ServerStartup.CHAT_NAME"), IChatChannel.class);
final RemoteMethodCall call = new RemoteMethodCall(rn.getName(), "chatOccured", new Object[] { message }, new Class<?>[] { String.class }, IChatChannel.class);
final SpokeInvoke spokeInvoke = new SpokeInvoke(null, false, call, getServerNode());
send(spokeInvoke, to);
}
use of games.strategy.engine.message.RemoteMethodCall in project triplea by triplea-game.
the class EndPointTest method testEndPoint.
@Test
public void testEndPoint() {
final EndPoint endPoint = new EndPoint("", Comparator.class, false);
endPoint.addImplementor((Comparator<Object>) (o1, o2) -> 2);
final RemoteMethodCall call = new RemoteMethodCall("", "compare", new Object[] { "", "" }, new Class<?>[] { Object.class, Object.class }, Comparator.class);
final List<RemoteMethodCallResults> results = endPoint.invokeLocal(call, endPoint.takeANumber(), null);
assertEquals(1, results.size());
assertEquals(2, (results.iterator().next()).getRVal());
}
use of games.strategy.engine.message.RemoteMethodCall in project triplea by triplea-game.
the class ClientMessenger method bareBonesSendMessageToServer.
private void bareBonesSendMessageToServer(final String methodName, final Object... messages) {
final List<Object> args = new ArrayList<>();
final Class<?>[] argTypes = new Class<?>[messages.length];
for (int i = 0; i < messages.length; i++) {
final Object message = messages[i];
args.add(message);
argTypes[i] = args.get(i).getClass();
}
final RemoteName rn = ServerModel.SERVER_REMOTE_NAME;
final RemoteMethodCall call = new RemoteMethodCall(rn.getName(), methodName, args.toArray(), argTypes, rn.getClazz());
final HubInvoke hubInvoke = new HubInvoke(null, false, call);
send(hubInvoke, getServerNode());
}
use of games.strategy.engine.message.RemoteMethodCall in project triplea by triplea-game.
the class Invoke method readExternal.
@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
needReturnValues = in.read() == 1;
if (needReturnValues) {
methodCallId = (GUID) in.readObject();
}
call = new RemoteMethodCall();
call.readExternal(in);
}
Aggregations