public void run(){
        isRunning = true;
        try{
            targetDataLine = (TargetDataLine)AudioSystem.getLine(sendInfo);
            targetDataLine.open(format, (int)sampleRate);
            targetDataLine.start();

            out = socket.getOutputStream();
            in = socket.getInputStream();
            line = (SourceDataLine) AudioSystem.getLine(playbackInfo);
            line.open(format);
            line.start();
            int     nBytesRead = 0;
            playbackData = new byte[Finals.BUFFER_SIZE];

            while (isRunning && nBytesRead!=-1) {
                targetDataLine.read(buffer, 0, buffer.length); //mic input
                out.write(buffer); //send sound
                //receive and output sound:
                nBytesRead = in.read(playbackData, 0, playbackData.length); //receive sound
                line.write(playbackData,  0, nBytesRead); //speaker output
            }

            line.drain();
            line.close();
            socket.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println(e);
            stopRunning();
            //probably the server closed it
        }
    }