added a unit test

This commit is contained in:
Edward Capriolo
2015-01-09 13:20:00 -05:00
parent 844b827dc6
commit bf5b777808
3 changed files with 55 additions and 11 deletions

View File

@ -36,27 +36,16 @@ abstract public class PassiveGossipThread implements Runnable {
public PassiveGossipThread(GossipManager gossipManager) {
_gossipManager = gossipManager;
// Start the service on the given port number.
try {
//_server = new DatagramSocket( _gossipManager.getMyself().getPort());
SocketAddress socketAddress = new InetSocketAddress(_gossipManager.getMyself().getHost(), _gossipManager.getMyself().getPort());
_server = new DatagramSocket(socketAddress);
// The server successfully started on the current port.
GossipService.info("Gossip service successfully initialized on port " + _gossipManager.getMyself().getPort());
GossipService.debug("I am " + _gossipManager.getMyself());
} catch (SocketException ex) {
System.err.println(ex);
_server = null;
// Let's communicate this to the user.
/*
GossipService.error("Error while starting the gossip service on port " + _gossipManager.getMyself().getPort() + ": " + ex.getMessage());
System.exit(-1);*/
throw new RuntimeException(ex);
}
_keepRunning = new AtomicBoolean(true);
}