daily pastebin goal
4%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public void testLiveConnections() throws Exception {
  2.         int serverPortNumber = 47348;
  3.         int clientPortNumber = 47348;
  4.         Server server = new Server(serverPortNumber);
  5.         Thread serverThread = new Thread(server);
  6.         serverThread.start();
  7.  
  8.         assertEquals(0, server.getConnections().size());
  9.  
  10.         Socket clientSocket = new Socket("localhost", clientPortNumber, null, 0);
  11.         UserClient userClient = new UserClient(clientSocket);
  12.         Thread.sleep(500);
  13.         assertEquals(1, server.getConnections().size());
  14.  
  15.         server.alertSocketClosed(server.getConnections().get(0));
  16.         assertEquals(0, server.getConnections().size());
  17.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top