@@ -0,0 +1,1461 @@
+package pl.edu.elka.models;%0A%0Aimport com.google.gson.Gson;%0Aimport pl.edu.elka.raj.Main;%0Aimport pl.edu.elka.util.Log;%0A%0Aimport java.io.BufferedWriter;%0Aimport java.io.OutputStreamWriter;%0Aimport java.net.Socket;%0A%0A/**%0A * Created by carol on 20/04/2016.%0A */%0Apublic class Node %7B%0A    private String pid;%0A    private Socket socket;%0A%0A    public Node(String pid, Socket socket, boolean isServer)%7B%0A        this.pid = pid;%0A        this.socket = socket;%0A    %7D%0A%0A    public Socket getSocket() %7B%0A        return socket;%0A    %7D%0A%0A    public void setSocket(Socket socket) %7B%0A        this.socket = socket;%0A    %7D%0A%0A    public String getPid() %7B%0A%0A        return pid;%0A    %7D%0A%0A    public void setPid(String pid) %7B%0A        this.pid = pid;%0A    %7D%0A%0A    public void write(Message message) throws Exception%7B%0A        BufferedWriter toNode = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));%0A        toNode.write(new Gson().toJson(message)+%22%5Cr%5Cn%22);%0A        toNode.flush();%0A%0A    %7D%0A%0A    public void close()%7B%0A        try %7B%0A            socket.getInputStream().close();%0A            socket.getOutputStream().close();%0A            socket.shutdownInput();%0A            socket.shutdownOutput();%0A            socket.close();%0A        %7D catch (Exception e)%7B%0A            Log.LogError(Log.SUBTYPE.SYSTEM, %22Problem closing socket. Message: %22+e.getMessage());%0A        %7D%0A    %7D%0A%0A    @Override%0A    public boolean equals(Object obj)%7B%0A        return obj!=null && ((Node)obj).getPid().equals(pid);%0A    %7D%0A%7D%0A

Create Node.java