-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathRunner.java
More file actions
33 lines (27 loc) · 801 Bytes
/
Runner.java
File metadata and controls
33 lines (27 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package chat;
import akka.actor.Actor;
import akka.actor.ActorRef;
import akka.actor.Actors;
import akka.actor.UntypedActor;
import chat.actors.ChatClient;
import chat.actors.ChatService;
/**
* Test runner emulating a chat session.
*/
public class Runner {
public static void main(String[] args) {
// Create ChatServer
ActorRef server = Actors.actorOf((Class<? extends Actor>) ChatService.class);
server.start();
// Create ChatClient
ChatClient client = new ChatClient("Alex");
client.login();
client.post("Hi there...");
System.out.println("***\nCHAT LOG:\n\t"
+ client.getChatLog().getLogString("\n\t") + "\n***");
client.post("Hi again...");
System.out.println("***\nCHAT LOG:\n\t"
+ client.getChatLog().getLogString("\n\t") + "\n***");
client.logout();
}
}