{"action":"created","comment":{"url":"https://api.github.com/repos/zaproxy/zap-extensions/pulls/comments/205885416","pull_request_review_id":141251626,"id":205885416,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNTg4NTQxNg==","diff_hunk":"@@ -0,0 +1,101 @@\n+/*\n+ * Zed Attack Proxy (ZAP) and its related class files.\n+ *\n+ * ZAP is an HTTP/HTTPS proxy for assessing web application security.\n+ *\n+ * Copyright 2018 The ZAP Development Team\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+\n+package org.zaproxy.zap.extension.websocket.client;\n+\n+import fi.iki.elonen.NanoWSD;\n+import org.junit.After;\n+import org.junit.Before;\n+import org.junit.Test;\n+\n+import static groovy.util.GroovyTestCase.assertEquals;\n+import static org.junit.Assert.assertTrue;\n+import org.parosproxy.paros.network.HttpMessage;\n+import org.zaproxy.zap.extension.websocket.ExtensionWebSocket;\n+import org.zaproxy.zap.extension.websocket.WebSocketProxy;\n+import org.zaproxy.zap.testutils.WebSocketTestUtils;\n+import org.zaproxy.zap.testutils.websocket.server.NanoWebSocketConnection;\n+\n+import java.util.List;\n+import java.util.Stack;\n+\n+public class WebSocketProxyUnitTest extends WebSocketTestUtils {\n+\t\n+\tprivate final static String HOST_NAME = \"localhost\";\n+\t\n+\t@Before\n+\tpublic void openWebSocketServer() throws Exception {\n+\t\tsuper.startWebSocketServer(HOST_NAME);\n+\t\tsuper.setUpZap();\n+\t}\n+\t\n+\t@After\n+\tpublic void stopWebSocketServer(){\n+\t\tsuper.stopWebSocketServer();\n+\t}\n+\t\n+\t@Override\n+\tprotected void setUpMessages() {\n+\t\tmockMessages(new ExtensionWebSocket());\n+\t}\n+\t\n+\t@Test\n+\tpublic void shouldAnswerToPingWithPong() throws Exception {\n+\t\tServerConnectionEstablisher establisher = new ServerConnectionEstablisher();\n+\t\tHttpMessage handshakeRequest = new HttpMessage(HttpHandshakeBuilder.getHttpHandshakeRequestHeader(super.getServertUrl()));\n+\t\t\n+\t\tWebSocketProxy webSocketProxy = establisher.send(new HandshakeConfig(handshakeRequest,false,false));\n+\t\tNanoWebSocketConnection webSocketConnection = super.getLastConnection();\n+\t\t\n+\t\twebSocketConnection.setPingScheduling(50,(\"1010\").getBytes());\n+\t\t\n+\t\tThread.sleep(250);\n+\t\t\n+\t\tassertTrue(webSocketProxy.isConnected());\n+\t\t\n+\t\tList<NanoWSD.WebSocketFrame> messages = webSocketConnection.getListOfIncomingMessages();\n+\t\tassertEquals(4, messages.size());\n+\t\tfor(int i = 0; i < messages.size(); i++){","path":"test/org/zaproxy/zap/extension/websocket/client/WebSocketProxyUnitTest.java","position":76,"original_position":76,"commit_id":"9353260f328265fca2b85fb1b23377d8a496fdb6","original_commit_id":"9353260f328265fca2b85fb1b23377d8a496fdb6","user":{"login":"thc202","id":4639210,"node_id":"MDQ6VXNlcjQ2MzkyMTA=","avatar_url":"https://avatars0.githubusercontent.com/u/4639210?v=4","gravatar_id":"","url":"https://api.github.com/users/thc202","html_url":"https://github.com/thc202","followers_url":"https://api.github.com/users/thc202/followers","following_url":"https://api.github.com/users/thc202/following{/other_user}","gists_url":"https://api.github.com/users/thc202/gists{/gist_id}","starred_url":"https://api.github.com/users/thc202/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thc202/subscriptions","organizations_url":"https://api.github.com/users/thc202/orgs","repos_url":"https://api.github.com/users/thc202/repos","events_url":"https://api.github.com/users/thc202/events{/privacy}","received_events_url":"https://api.github.com/users/thc202/received_events","type":"User","site_admin":false},"body":"Could use an enhanced for.","created_at":"2018-07-27T20:06:11Z","updated_at":"2018-07-27T20:06:49Z","html_url":"https://github.com/zaproxy/zap-extensions/pull/1738#discussion_r205885416","pull_request_url":"https://api.github.com/repos/zaproxy/zap-extensions/pulls/1738","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/zaproxy/zap-extensions/pulls/comments/205885416"},"html":{"href":"https://github.com/zaproxy/zap-extensions/pull/1738#discussion_r205885416"},"pull_request":{"href":"https://api.github.com/repos/zaproxy/zap-extensions/pulls/1738"}}},"pull_request":{"url":"https://api.github.com/repos/zaproxy/zap-extensions/pulls/1738","id":203967339,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAzOTY3MzM5","html_url":"https://github.com/zaproxy/zap-extensions/pull/1738","diff_url":"https://github.com/zaproxy/zap-extensions/pull/1738.diff","patch_url":"https://github.com/zaproxy/zap-extensions/pull/1738.patch","issue_url":"https://api.github.com/repos/zaproxy/zap-extensions/issues/1738","number":1738,"state":"open","locked":false,"title":"Tests for ServerConnectionEstablisher and WebSocketProxy","user":{"login":"ManosMagnus","id":10010230,"node_id":"MDQ6VXNlcjEwMDEwMjMw","avatar_url":"https://avatars3.githubusercontent.com/u/10010230?v=4","gravatar_id":"","url":"https://api.github.com/users/ManosMagnus","html_url":"https://github.com/ManosMagnus","followers_url":"https://api.github.com/users/ManosMagnus/followers","following_url":"https://api.github.com/users/ManosMagnus/following{/other_user}","gists_url":"https://api.github.com/users/ManosMagnus/gists{/gist_id}","starred_url":"https://api.github.com/users/ManosMagnus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManosMagnus/subscriptions","organizations_url":"https://api.github.com/users/ManosMagnus/orgs","repos_url":"https://api.github.com/users/ManosMagnus/repos","events_url":"https://api.github.com/users/ManosMagnus/events{/privacy}","received_events_url":"https://api.github.com/users/ManosMagnus/received_events","type":"User","site_admin":false},"body":"Tests if ServerConnectionEstablisher establishes WebSocket Connection correctly. Also,\r\ntest added for WebSocketProxy automate ping response.\r\n\r\nTests for PRs #1689 & #1686  ","created_at":"2018-07-25T21:22:31Z","updated_at":"2018-07-27T20:06:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ae6aa0ecf22ffb66f8a6fade679b0743ada7cd0f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/zaproxy/zap-extensions/pulls/1738/commits","review_comments_url":"https://api.github.com/repos/zaproxy/zap-extensions/pulls/1738/comments","review_comment_url":"https://api.github.com/repos/zaproxy/zap-extensions/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zaproxy/zap-extensions/issues/1738/comments","statuses_url":"https://api.github.com/repos/zaproxy/zap-extensions/statuses/9353260f328265fca2b85fb1b23377d8a496fdb6","head":{"label":"ManosMagnus:test_websocke_client","ref":"test_websocke_client","sha":"9353260f328265fca2b85fb1b23377d8a496fdb6","user":{"login":"ManosMagnus","id":10010230,"node_id":"MDQ6VXNlcjEwMDEwMjMw","avatar_url":"https://avatars3.githubusercontent.com/u/10010230?v=4","gravatar_id":"","url":"https://api.github.com/users/ManosMagnus","html_url":"https://github.com/ManosMagnus","followers_url":"https://api.github.com/users/ManosMagnus/followers","following_url":"https://api.github.com/users/ManosMagnus/following{/other_user}","gists_url":"https://api.github.com/users/ManosMagnus/gists{/gist_id}","starred_url":"https://api.github.com/users/ManosMagnus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManosMagnus/subscriptions","organizations_url":"https://api.github.com/users/ManosMagnus/orgs","repos_url":"https://api.github.com/users/ManosMagnus/repos","events_url":"https://api.github.com/users/ManosMagnus/events{/privacy}","received_events_url":"https://api.github.com/users/ManosMagnus/received_events","type":"User","site_admin":false},"repo":{"id":123298911,"node_id":"MDEwOlJlcG9zaXRvcnkxMjMyOTg5MTE=","name":"zap-extensions","full_name":"ManosMagnus/zap-extensions","owner":{"login":"ManosMagnus","id":10010230,"node_id":"MDQ6VXNlcjEwMDEwMjMw","avatar_url":"https://avatars3.githubusercontent.com/u/10010230?v=4","gravatar_id":"","url":"https://api.github.com/users/ManosMagnus","html_url":"https://github.com/ManosMagnus","followers_url":"https://api.github.com/users/ManosMagnus/followers","following_url":"https://api.github.com/users/ManosMagnus/following{/other_user}","gists_url":"https://api.github.com/users/ManosMagnus/gists{/gist_id}","starred_url":"https://api.github.com/users/ManosMagnus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManosMagnus/subscriptions","organizations_url":"https://api.github.com/users/ManosMagnus/orgs","repos_url":"https://api.github.com/users/ManosMagnus/repos","events_url":"https://api.github.com/users/ManosMagnus/events{/privacy}","received_events_url":"https://api.github.com/users/ManosMagnus/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ManosMagnus/zap-extensions","description":"OWASP ZAP Add-ons","fork":true,"url":"https://api.github.com/repos/ManosMagnus/zap-extensions","forks_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/forks","keys_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/teams","hooks_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/hooks","issue_events_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/issues/events{/number}","events_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/events","assignees_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/assignees{/user}","branches_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/branches{/branch}","tags_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/tags","blobs_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/git/refs{/sha}","trees_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/statuses/{sha}","languages_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/languages","stargazers_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/stargazers","contributors_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/contributors","subscribers_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/subscribers","subscription_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/subscription","commits_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/commits{/sha}","git_commits_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/git/commits{/sha}","comments_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/comments{/number}","issue_comment_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/issues/comments{/number}","contents_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/contents/{+path}","compare_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/merges","archive_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/downloads","issues_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/issues{/number}","pulls_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/pulls{/number}","milestones_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/milestones{/number}","notifications_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/labels{/name}","releases_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/releases{/id}","deployments_url":"https://api.github.com/repos/ManosMagnus/zap-extensions/deployments","created_at":"2018-02-28T14:48:58Z","updated_at":"2018-07-09T16:42:53Z","pushed_at":"2018-07-27T11:43:11Z","git_url":"git://github.com/ManosMagnus/zap-extensions.git","ssh_url":"git@github.com:ManosMagnus/zap-extensions.git","clone_url":"https://github.com/ManosMagnus/zap-extensions.git","svn_url":"https://github.com/ManosMagnus/zap-extensions","homepage":"","size":884209,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"zaproxy:master","ref":"master","sha":"c02a37dcd46cbdb60c236c03107116736bfed276","user":{"login":"zaproxy","id":6716868,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3MTY4Njg=","avatar_url":"https://avatars2.githubusercontent.com/u/6716868?v=4","gravatar_id":"","url":"https://api.github.com/users/zaproxy","html_url":"https://github.com/zaproxy","followers_url":"https://api.github.com/users/zaproxy/followers","following_url":"https://api.github.com/users/zaproxy/following{/other_user}","gists_url":"https://api.github.com/users/zaproxy/gists{/gist_id}","starred_url":"https://api.github.com/users/zaproxy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zaproxy/subscriptions","organizations_url":"https://api.github.com/users/zaproxy/orgs","repos_url":"https://api.github.com/users/zaproxy/repos","events_url":"https://api.github.com/users/zaproxy/events{/privacy}","received_events_url":"https://api.github.com/users/zaproxy/received_events","type":"Organization","site_admin":false},"repo":{"id":35210580,"node_id":"MDEwOlJlcG9zaXRvcnkzNTIxMDU4MA==","name":"zap-extensions","full_name":"zaproxy/zap-extensions","owner":{"login":"zaproxy","id":6716868,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3MTY4Njg=","avatar_url":"https://avatars2.githubusercontent.com/u/6716868?v=4","gravatar_id":"","url":"https://api.github.com/users/zaproxy","html_url":"https://github.com/zaproxy","followers_url":"https://api.github.com/users/zaproxy/followers","following_url":"https://api.github.com/users/zaproxy/following{/other_user}","gists_url":"https://api.github.com/users/zaproxy/gists{/gist_id}","starred_url":"https://api.github.com/users/zaproxy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zaproxy/subscriptions","organizations_url":"https://api.github.com/users/zaproxy/orgs","repos_url":"https://api.github.com/users/zaproxy/repos","events_url":"https://api.github.com/users/zaproxy/events{/privacy}","received_events_url":"https://api.github.com/users/zaproxy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zaproxy/zap-extensions","description":"OWASP ZAP Add-ons","fork":false,"url":"https://api.github.com/repos/zaproxy/zap-extensions","forks_url":"https://api.github.com/repos/zaproxy/zap-extensions/forks","keys_url":"https://api.github.com/repos/zaproxy/zap-extensions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zaproxy/zap-extensions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zaproxy/zap-extensions/teams","hooks_url":"https://api.github.com/repos/zaproxy/zap-extensions/hooks","issue_events_url":"https://api.github.com/repos/zaproxy/zap-extensions/issues/events{/number}","events_url":"https://api.github.com/repos/zaproxy/zap-extensions/events","assignees_url":"https://api.github.com/repos/zaproxy/zap-extensions/assignees{/user}","branches_url":"https://api.github.com/repos/zaproxy/zap-extensions/branches{/branch}","tags_url":"https://api.github.com/repos/zaproxy/zap-extensions/tags","blobs_url":"https://api.github.com/repos/zaproxy/zap-extensions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zaproxy/zap-extensions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zaproxy/zap-extensions/git/refs{/sha}","trees_url":"https://api.github.com/repos/zaproxy/zap-extensions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zaproxy/zap-extensions/statuses/{sha}","languages_url":"https://api.github.com/repos/zaproxy/zap-extensions/languages","stargazers_url":"https://api.github.com/repos/zaproxy/zap-extensions/stargazers","contributors_url":"https://api.github.com/repos/zaproxy/zap-extensions/contributors","subscribers_url":"https://api.github.com/repos/zaproxy/zap-extensions/subscribers","subscription_url":"https://api.github.com/repos/zaproxy/zap-extensions/subscription","commits_url":"https://api.github.com/repos/zaproxy/zap-extensions/commits{/sha}","git_commits_url":"https://api.github.com/repos/zaproxy/zap-extensions/git/commits{/sha}","comments_url":"https://api.github.com/repos/zaproxy/zap-extensions/comments{/number}","issue_comment_url":"https://api.github.com/repos/zaproxy/zap-extensions/issues/comments{/number}","contents_url":"https://api.github.com/repos/zaproxy/zap-extensions/contents/{+path}","compare_url":"https://api.github.com/repos/zaproxy/zap-extensions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zaproxy/zap-extensions/merges","archive_url":"https://api.github.com/repos/zaproxy/zap-extensions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zaproxy/zap-extensions/downloads","issues_url":"https://api.github.com/repos/zaproxy/zap-extensions/issues{/number}","pulls_url":"https://api.github.com/repos/zaproxy/zap-extensions/pulls{/number}","milestones_url":"https://api.github.com/repos/zaproxy/zap-extensions/milestones{/number}","notifications_url":"https://api.github.com/repos/zaproxy/zap-extensions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zaproxy/zap-extensions/labels{/name}","releases_url":"https://api.github.com/repos/zaproxy/zap-extensions/releases{/id}","deployments_url":"https://api.github.com/repos/zaproxy/zap-extensions/deployments","created_at":"2015-05-07T09:17:13Z","updated_at":"2018-07-27T16:17:06Z","pushed_at":"2018-07-27T11:43:13Z","git_url":"git://github.com/zaproxy/zap-extensions.git","ssh_url":"git@github.com:zaproxy/zap-extensions.git","clone_url":"https://github.com/zaproxy/zap-extensions.git","svn_url":"https://github.com/zaproxy/zap-extensions","homepage":"","size":903480,"stargazers_count":239,"watchers_count":239,"language":"HTML","has_issues":false,"has_projects":false,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":253,"mirror_url":null,"archived":false,"open_issues_count":19,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":253,"open_issues":19,"watchers":239,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zaproxy/zap-extensions/pulls/1738"},"html":{"href":"https://github.com/zaproxy/zap-extensions/pull/1738"},"issue":{"href":"https://api.github.com/repos/zaproxy/zap-extensions/issues/1738"},"comments":{"href":"https://api.github.com/repos/zaproxy/zap-extensions/issues/1738/comments"},"review_comments":{"href":"https://api.github.com/repos/zaproxy/zap-extensions/pulls/1738/comments"},"review_comment":{"href":"https://api.github.com/repos/zaproxy/zap-extensions/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zaproxy/zap-extensions/pulls/1738/commits"},"statuses":{"href":"https://api.github.com/repos/zaproxy/zap-extensions/statuses/9353260f328265fca2b85fb1b23377d8a496fdb6"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"thc202"}}