package ch.heigvd.res.labs.roulette.net.client;

import ch.heigvd.res.labs.roulette.data.EmptyStoreException;
import ch.heigvd.res.labs.roulette.data.JsonObjectMapper;
import ch.heigvd.res.labs.roulette.net.protocol.RouletteV1Protocol;
import ch.heigvd.res.labs.roulette.data.Student;
import ch.heigvd.res.labs.roulette.net.protocol.InfoCommandResponse;
import ch.heigvd.res.labs.roulette.net.protocol.RandomCommandResponse;
import jdk.nashorn.internal.parser.JSONParser;

import java.io.*;
import java.net.Socket;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;


/**
 * This class implements the client side of the protocol specification (version 1).
 * 
 * @author Olivier Liechti
 */
public class RouletteV1ClientImpl implements IRouletteV1Client {
  private Socket clientS;
  private DataOutputStream outToServer;
  private BufferedReader inFromServer;
  private JsonObjectMapper jsm;


    private static final Logger LOG = Logger.getLogger(RouletteV1ClientImpl.class.getName());
    private Socket clientSocket;

    @Override
    public void connect(String server, int port) throws IOException {
        clientSocket = new Socket(server, port);
        
        BufferedReader reader = new BufferedReader(new InputStreamReader(clientSocket.getInputStream(), "UTF-8"));
        reader.readLine();
    }

    @Override
    public void disconnect() throws IOException {
        clientSocket.close();
    }

    @Override
    public boolean isConnected() {
        return clientSocket.isConnected();
    }

    @Override
    public void loadStudent(String fullname) throws IOException {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void loadStudents(List<Student> students) throws IOException {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public Student pickRandomStudent() throws EmptyStoreException, IOException {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public int getNumberOfStudents() throws IOException {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public String getProtocolVersion() throws IOException {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

}

@@ -430,48 +430,128 @@
 rt j
-dk.nashorn.internal.parser.JSONPars
+ava.io.BufferedReader;%0Aimport java.io.IOException;%0Aimport java.io.InputStreamReader;%0Aimport java.io.OutputStreamWrit
 er;%0A
-%0A
 impo
@@ -561,17 +561,27 @@
 java.io.
-*
+PrintWriter
 ;%0Aimport
@@ -687,17 +687,16 @@
 ogger;%0A%0A
-%0A
 /**%0A * T
@@ -879,149 +879,9 @@
 t %7B%0A
-  private Socket clientS;%0A  private DataOutputStream outToServer;%0A  private BufferedReader inFromServer;%0A  private JsonObjectMapper jsm;%0A%0A%0A  
+%0A
   pr
@@ -972,44 +972,9 @@
 ));%0A
-    private Socket clientSocket;%0A%0A  
+%0A
   @O
@@ -973,34 +973,32 @@
 );%0A%0A  @Override%0A
-  
   public void co
@@ -1057,213 +1057,141 @@
     
- 
-   clientSocket = new Socket(server, port);%0A        %0A        BufferedReader reader = new BufferedReader(new InputStreamReader(clientSocket.getInputStream(), %22UTF-8%22));%0A        reader.readLine();%0A  
+throw new UnsupportedOperationException(%22Not supported yet.%22); //To change body of generated methods, choose Tools %7C Templates.%0A
   %7D%0A%0A
-  
   @O
@@ -1190,34 +1190,32 @@
  %7D%0A%0A  @Override%0A
-  
   public void di
@@ -1254,45 +1254,143 @@
     
-    clientSocket.close();%0A  
+throw new UnsupportedOperationException(%22Not supported yet.%22); //To change body of generated methods, choose Tools %7C Templates.%0A
   %7D%0A%0A  
- 
- 
 @Ove
@@ -1387,34 +1387,32 @@
  %7D%0A%0A  @Override%0A
-  
   public boolean
@@ -1436,56 +1436,141 @@
     
-    return clientSocket.isConnected();%0A  
+throw new UnsupportedOperationException(%22Not supported yet.%22); //To change body of generated methods, choose Tools %7C Templates.%0A
   %7D%0A%0A
-  
   @O
@@ -1569,34 +1569,32 @@
  %7D%0A%0A  @Override%0A
-  
   public void lo
@@ -1633,36 +1633,32 @@
 s IOException %7B%0A
-    
     throw new Un
@@ -1769,33 +1769,29 @@
  Templates.%0A
-  
   %7D%0A%0A
-  
   @Override%0A
@@ -1782,34 +1782,32 @@
  %7D%0A%0A  @Override%0A
-  
   public void lo
@@ -1854,36 +1854,32 @@
 s IOException %7B%0A
-    
     throw new Un
@@ -1988,39 +1988,35 @@
  %7C Templates.%0A  
- 
- 
 %7D%0A%0A
-  
   @Override%0A    
@@ -2003,34 +2003,32 @@
  %7D%0A%0A  @Override%0A
-  
   public Student
@@ -2082,36 +2082,32 @@
 , IOException %7B%0A
-    
     throw new Un
@@ -2218,33 +2218,29 @@
  Templates.%0A
-  
   %7D%0A%0A
-  
   @Override%0A
@@ -2231,34 +2231,32 @@
  %7D%0A%0A  @Override%0A
-  
   public int get
@@ -2287,36 +2287,32 @@
 s IOException %7B%0A
-    
     throw new Un
@@ -2431,19 +2431,15 @@
 es.%0A
-  
   %7D%0A%0A  
- 
- 
 @Ove
@@ -2444,18 +2444,16 @@
 verride%0A
-  
   public
@@ -2502,20 +2502,16 @@
 ption %7B%0A
-    
     thro
@@ -2636,15 +2636,15 @@
 ates.%0A  
-  %7D
+%7D%0A%0A
 %0A%0A%7D%0A

Remove implementation files introduced by a student