{"action":"created","comment":{"url":"https://api.github.com/repos/StasBel/JavaHomework/pulls/comments/57517174","id":57517174,"diff_hunk":"@@ -0,0 +1,136 @@\n+package ru.spbau.mit.client;\n+\n+import ru.spbau.mit.Connection;\n+import ru.spbau.mit.File;\n+\n+import java.io.DataInputStream;\n+import java.io.DataOutputStream;\n+import java.io.IOException;\n+import java.net.InetAddress;\n+import java.net.Socket;\n+import java.net.UnknownHostException;\n+import java.util.ArrayList;\n+import java.util.List;\n+\n+/**\n+ * Created by belaevstanislav on 14.03.16.\n+ * SPBAU Java practice.\n+ */\n+\n+public class Client implements ClientAction {\n+    private static final int LIST_NUMBER = 1;\n+    private static final int GET_NUMBER = 2;\n+\n+    private final int portNumber;\n+    private final String ipAddress;\n+    private ClientConnection connection;\n+\n+    public Client(int portNumber, String ipAddress) {\n+        this.portNumber = portNumber;\n+        this.ipAddress = ipAddress;\n+    }\n+\n+    @Override\n+    public void connect() throws UnknownHostException, IOException {\n+        connection = new ClientConnection(\n+                new Socket(InetAddress.getByName(ipAddress), portNumber)\n+        );\n+    }\n+\n+    @Override\n+    public void disconnect() throws IOException {\n+        connection.close();\n+    }\n+\n+    @Override\n+    public ListAnswer executeList(String path) throws IOException {\n+        connection.executeList(path);\n+        return connection.fetchAnswerList();\n+    }\n+\n+    @Override\n+    public GetAnswer executeGet(String path) throws IOException {\n+        connection.executeGet(path);\n+        return connection.fetchAnswerGet();\n+    }","path":"src/main/java/ru/spbau/mit/client/Client.java","position":55,"original_position":55,"commit_id":"8a7b3f75c1a990f34371a391f5a28768fd4a189c","original_commit_id":"8a7b3f75c1a990f34371a391f5a28768fd4a189c","user":{"login":"sproshev","id":4990763,"avatar_url":"https://avatars.githubusercontent.com/u/4990763?v=3","gravatar_id":"","url":"https://api.github.com/users/sproshev","html_url":"https://github.com/sproshev","followers_url":"https://api.github.com/users/sproshev/followers","following_url":"https://api.github.com/users/sproshev/following{/other_user}","gists_url":"https://api.github.com/users/sproshev/gists{/gist_id}","starred_url":"https://api.github.com/users/sproshev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sproshev/subscriptions","organizations_url":"https://api.github.com/users/sproshev/orgs","repos_url":"https://api.github.com/users/sproshev/repos","events_url":"https://api.github.com/users/sproshev/events{/privacy}","received_events_url":"https://api.github.com/users/sproshev/received_events","type":"User","site_admin":false},"body":"хорошо бы в трех методах выше проверять, что подключение создано","created_at":"2016-03-26T18:12:38Z","updated_at":"2016-03-26T18:12:38Z","html_url":"https://github.com/StasBel/JavaHomework/pull/3#discussion_r57517174","pull_request_url":"https://api.github.com/repos/StasBel/JavaHomework/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/StasBel/JavaHomework/pulls/comments/57517174"},"html":{"href":"https://github.com/StasBel/JavaHomework/pull/3#discussion_r57517174"},"pull_request":{"href":"https://api.github.com/repos/StasBel/JavaHomework/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/StasBel/JavaHomework/pulls/3","id":63468801,"html_url":"https://github.com/StasBel/JavaHomework/pull/3","diff_url":"https://github.com/StasBel/JavaHomework/pull/3.diff","patch_url":"https://github.com/StasBel/JavaHomework/pull/3.patch","issue_url":"https://api.github.com/repos/StasBel/JavaHomework/issues/3","number":3,"state":"open","locked":false,"title":"Java02. ДЗ 03, Беляев Станислав, подгруппа 2","user":{"login":"StasBel","id":12044462,"avatar_url":"https://avatars.githubusercontent.com/u/12044462?v=3","gravatar_id":"","url":"https://api.github.com/users/StasBel","html_url":"https://github.com/StasBel","followers_url":"https://api.github.com/users/StasBel/followers","following_url":"https://api.github.com/users/StasBel/following{/other_user}","gists_url":"https://api.github.com/users/StasBel/gists{/gist_id}","starred_url":"https://api.github.com/users/StasBel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StasBel/subscriptions","organizations_url":"https://api.github.com/users/StasBel/orgs","repos_url":"https://api.github.com/users/StasBel/repos","events_url":"https://api.github.com/users/StasBel/events{/privacy}","received_events_url":"https://api.github.com/users/StasBel/received_events","type":"User","site_admin":false},"body":"@sproshev","created_at":"2016-03-19T14:15:12Z","updated_at":"2016-03-26T18:12:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f898b645f7411c92568fb94e9a8e6c34d770d681","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/StasBel/JavaHomework/pulls/3/commits","review_comments_url":"https://api.github.com/repos/StasBel/JavaHomework/pulls/3/comments","review_comment_url":"https://api.github.com/repos/StasBel/JavaHomework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/StasBel/JavaHomework/issues/3/comments","statuses_url":"https://api.github.com/repos/StasBel/JavaHomework/statuses/8a7b3f75c1a990f34371a391f5a28768fd4a189c","head":{"label":"StasBel:task03","ref":"task03","sha":"8a7b3f75c1a990f34371a391f5a28768fd4a189c","user":{"login":"StasBel","id":12044462,"avatar_url":"https://avatars.githubusercontent.com/u/12044462?v=3","gravatar_id":"","url":"https://api.github.com/users/StasBel","html_url":"https://github.com/StasBel","followers_url":"https://api.github.com/users/StasBel/followers","following_url":"https://api.github.com/users/StasBel/following{/other_user}","gists_url":"https://api.github.com/users/StasBel/gists{/gist_id}","starred_url":"https://api.github.com/users/StasBel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StasBel/subscriptions","organizations_url":"https://api.github.com/users/StasBel/orgs","repos_url":"https://api.github.com/users/StasBel/repos","events_url":"https://api.github.com/users/StasBel/events{/privacy}","received_events_url":"https://api.github.com/users/StasBel/received_events","type":"User","site_admin":false},"repo":{"id":51698561,"name":"JavaHomework","full_name":"StasBel/JavaHomework","owner":{"login":"StasBel","id":12044462,"avatar_url":"https://avatars.githubusercontent.com/u/12044462?v=3","gravatar_id":"","url":"https://api.github.com/users/StasBel","html_url":"https://github.com/StasBel","followers_url":"https://api.github.com/users/StasBel/followers","following_url":"https://api.github.com/users/StasBel/following{/other_user}","gists_url":"https://api.github.com/users/StasBel/gists{/gist_id}","starred_url":"https://api.github.com/users/StasBel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StasBel/subscriptions","organizations_url":"https://api.github.com/users/StasBel/orgs","repos_url":"https://api.github.com/users/StasBel/repos","events_url":"https://api.github.com/users/StasBel/events{/privacy}","received_events_url":"https://api.github.com/users/StasBel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/StasBel/JavaHomework","description":"","fork":false,"url":"https://api.github.com/repos/StasBel/JavaHomework","forks_url":"https://api.github.com/repos/StasBel/JavaHomework/forks","keys_url":"https://api.github.com/repos/StasBel/JavaHomework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StasBel/JavaHomework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StasBel/JavaHomework/teams","hooks_url":"https://api.github.com/repos/StasBel/JavaHomework/hooks","issue_events_url":"https://api.github.com/repos/StasBel/JavaHomework/issues/events{/number}","events_url":"https://api.github.com/repos/StasBel/JavaHomework/events","assignees_url":"https://api.github.com/repos/StasBel/JavaHomework/assignees{/user}","branches_url":"https://api.github.com/repos/StasBel/JavaHomework/branches{/branch}","tags_url":"https://api.github.com/repos/StasBel/JavaHomework/tags","blobs_url":"https://api.github.com/repos/StasBel/JavaHomework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StasBel/JavaHomework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StasBel/JavaHomework/git/refs{/sha}","trees_url":"https://api.github.com/repos/StasBel/JavaHomework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StasBel/JavaHomework/statuses/{sha}","languages_url":"https://api.github.com/repos/StasBel/JavaHomework/languages","stargazers_url":"https://api.github.com/repos/StasBel/JavaHomework/stargazers","contributors_url":"https://api.github.com/repos/StasBel/JavaHomework/contributors","subscribers_url":"https://api.github.com/repos/StasBel/JavaHomework/subscribers","subscription_url":"https://api.github.com/repos/StasBel/JavaHomework/subscription","commits_url":"https://api.github.com/repos/StasBel/JavaHomework/commits{/sha}","git_commits_url":"https://api.github.com/repos/StasBel/JavaHomework/git/commits{/sha}","comments_url":"https://api.github.com/repos/StasBel/JavaHomework/comments{/number}","issue_comment_url":"https://api.github.com/repos/StasBel/JavaHomework/issues/comments{/number}","contents_url":"https://api.github.com/repos/StasBel/JavaHomework/contents/{+path}","compare_url":"https://api.github.com/repos/StasBel/JavaHomework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StasBel/JavaHomework/merges","archive_url":"https://api.github.com/repos/StasBel/JavaHomework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StasBel/JavaHomework/downloads","issues_url":"https://api.github.com/repos/StasBel/JavaHomework/issues{/number}","pulls_url":"https://api.github.com/repos/StasBel/JavaHomework/pulls{/number}","milestones_url":"https://api.github.com/repos/StasBel/JavaHomework/milestones{/number}","notifications_url":"https://api.github.com/repos/StasBel/JavaHomework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StasBel/JavaHomework/labels{/name}","releases_url":"https://api.github.com/repos/StasBel/JavaHomework/releases{/id}","deployments_url":"https://api.github.com/repos/StasBel/JavaHomework/deployments","created_at":"2016-02-14T14:49:31Z","updated_at":"2016-02-14T14:49:31Z","pushed_at":"2016-03-22T10:18:14Z","git_url":"git://github.com/StasBel/JavaHomework.git","ssh_url":"git@github.com:StasBel/JavaHomework.git","clone_url":"https://github.com/StasBel/JavaHomework.git","svn_url":"https://github.com/StasBel/JavaHomework","homepage":null,"size":97,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"StasBel:master","ref":"master","sha":"bed4d386b3a99ce5f2d67d67ddaba65a12d138ac","user":{"login":"StasBel","id":12044462,"avatar_url":"https://avatars.githubusercontent.com/u/12044462?v=3","gravatar_id":"","url":"https://api.github.com/users/StasBel","html_url":"https://github.com/StasBel","followers_url":"https://api.github.com/users/StasBel/followers","following_url":"https://api.github.com/users/StasBel/following{/other_user}","gists_url":"https://api.github.com/users/StasBel/gists{/gist_id}","starred_url":"https://api.github.com/users/StasBel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StasBel/subscriptions","organizations_url":"https://api.github.com/users/StasBel/orgs","repos_url":"https://api.github.com/users/StasBel/repos","events_url":"https://api.github.com/users/StasBel/events{/privacy}","received_events_url":"https://api.github.com/users/StasBel/received_events","type":"User","site_admin":false},"repo":{"id":51698561,"name":"JavaHomework","full_name":"StasBel/JavaHomework","owner":{"login":"StasBel","id":12044462,"avatar_url":"https://avatars.githubusercontent.com/u/12044462?v=3","gravatar_id":"","url":"https://api.github.com/users/StasBel","html_url":"https://github.com/StasBel","followers_url":"https://api.github.com/users/StasBel/followers","following_url":"https://api.github.com/users/StasBel/following{/other_user}","gists_url":"https://api.github.com/users/StasBel/gists{/gist_id}","starred_url":"https://api.github.com/users/StasBel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StasBel/subscriptions","organizations_url":"https://api.github.com/users/StasBel/orgs","repos_url":"https://api.github.com/users/StasBel/repos","events_url":"https://api.github.com/users/StasBel/events{/privacy}","received_events_url":"https://api.github.com/users/StasBel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/StasBel/JavaHomework","description":"","fork":false,"url":"https://api.github.com/repos/StasBel/JavaHomework","forks_url":"https://api.github.com/repos/StasBel/JavaHomework/forks","keys_url":"https://api.github.com/repos/StasBel/JavaHomework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StasBel/JavaHomework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StasBel/JavaHomework/teams","hooks_url":"https://api.github.com/repos/StasBel/JavaHomework/hooks","issue_events_url":"https://api.github.com/repos/StasBel/JavaHomework/issues/events{/number}","events_url":"https://api.github.com/repos/StasBel/JavaHomework/events","assignees_url":"https://api.github.com/repos/StasBel/JavaHomework/assignees{/user}","branches_url":"https://api.github.com/repos/StasBel/JavaHomework/branches{/branch}","tags_url":"https://api.github.com/repos/StasBel/JavaHomework/tags","blobs_url":"https://api.github.com/repos/StasBel/JavaHomework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StasBel/JavaHomework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StasBel/JavaHomework/git/refs{/sha}","trees_url":"https://api.github.com/repos/StasBel/JavaHomework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StasBel/JavaHomework/statuses/{sha}","languages_url":"https://api.github.com/repos/StasBel/JavaHomework/languages","stargazers_url":"https://api.github.com/repos/StasBel/JavaHomework/stargazers","contributors_url":"https://api.github.com/repos/StasBel/JavaHomework/contributors","subscribers_url":"https://api.github.com/repos/StasBel/JavaHomework/subscribers","subscription_url":"https://api.github.com/repos/StasBel/JavaHomework/subscription","commits_url":"https://api.github.com/repos/StasBel/JavaHomework/commits{/sha}","git_commits_url":"https://api.github.com/repos/StasBel/JavaHomework/git/commits{/sha}","comments_url":"https://api.github.com/repos/StasBel/JavaHomework/comments{/number}","issue_comment_url":"https://api.github.com/repos/StasBel/JavaHomework/issues/comments{/number}","contents_url":"https://api.github.com/repos/StasBel/JavaHomework/contents/{+path}","compare_url":"https://api.github.com/repos/StasBel/JavaHomework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StasBel/JavaHomework/merges","archive_url":"https://api.github.com/repos/StasBel/JavaHomework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StasBel/JavaHomework/downloads","issues_url":"https://api.github.com/repos/StasBel/JavaHomework/issues{/number}","pulls_url":"https://api.github.com/repos/StasBel/JavaHomework/pulls{/number}","milestones_url":"https://api.github.com/repos/StasBel/JavaHomework/milestones{/number}","notifications_url":"https://api.github.com/repos/StasBel/JavaHomework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StasBel/JavaHomework/labels{/name}","releases_url":"https://api.github.com/repos/StasBel/JavaHomework/releases{/id}","deployments_url":"https://api.github.com/repos/StasBel/JavaHomework/deployments","created_at":"2016-02-14T14:49:31Z","updated_at":"2016-02-14T14:49:31Z","pushed_at":"2016-03-22T10:18:14Z","git_url":"git://github.com/StasBel/JavaHomework.git","ssh_url":"git@github.com:StasBel/JavaHomework.git","clone_url":"https://github.com/StasBel/JavaHomework.git","svn_url":"https://github.com/StasBel/JavaHomework","homepage":null,"size":97,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/StasBel/JavaHomework/pulls/3"},"html":{"href":"https://github.com/StasBel/JavaHomework/pull/3"},"issue":{"href":"https://api.github.com/repos/StasBel/JavaHomework/issues/3"},"comments":{"href":"https://api.github.com/repos/StasBel/JavaHomework/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/StasBel/JavaHomework/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/StasBel/JavaHomework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/StasBel/JavaHomework/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/StasBel/JavaHomework/statuses/8a7b3f75c1a990f34371a391f5a28768fd4a189c"}}}}