{"action":"created","comment":{"url":"https://api.github.com/repos/uber/tchannel-java/pulls/comments/40171598","id":40171598,"diff_hunk":"@@ -0,0 +1,123 @@\n+/*\n+ * Copyright (c) 2015 Uber Technologies, Inc.\n+ *\n+ * Permission is hereby granted, free of charge, to any person obtaining a copy\n+ * of this software and associated documentation files (the \"Software\"), to deal\n+ * in the Software without restriction, including without limitation the rights\n+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n+ * copies of the Software, and to permit persons to whom the Software is\n+ * furnished to do so, subject to the following conditions:\n+ *\n+ * The above copyright notice and this permission notice shall be included in\n+ * all copies or substantial portions of the Software.\n+ *\n+ * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n+ * THE SOFTWARE.\n+ */\n+\n+package com.uber.tchannel.hyperbahn.api;\n+\n+import com.google.gson.Gson;\n+import com.uber.tchannel.api.Request;\n+import com.uber.tchannel.api.Response;\n+import com.uber.tchannel.api.TChannel;\n+import com.uber.tchannel.hyperbahn.messages.AdvertiseRequest;\n+import com.uber.tchannel.hyperbahn.messages.AdvertiseResponse;\n+import io.netty.util.concurrent.Future;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+\n+import java.io.FileReader;\n+import java.io.IOException;\n+import java.io.Reader;\n+import java.net.InetSocketAddress;\n+import java.util.LinkedList;\n+import java.util.List;\n+import java.util.Random;\n+import java.util.concurrent.ExecutionException;\n+import java.util.concurrent.TimeUnit;\n+import java.util.concurrent.TimeoutException;\n+import java.util.regex.Pattern;\n+\n+public class HyperbahnClient {\n+\n+    private static final String HOSTS_FILE_PATH = \"/etc/uber/hyperbahn/hosts.json\";","path":"tchannel-hyperbahn/src/main/java/com/uber/tchannel/hyperbahn/api/HyperbahnClient.java","position":49,"original_position":49,"commit_id":"8d04274b1b3403a209c3bf5bf5d913178f03f6d8","original_commit_id":"8d04274b1b3403a209c3bf5bf5d913178f03f6d8","user":{"login":"truncs","id":157234,"avatar_url":"https://avatars.githubusercontent.com/u/157234?v=3","gravatar_id":"","url":"https://api.github.com/users/truncs","html_url":"https://github.com/truncs","followers_url":"https://api.github.com/users/truncs/followers","following_url":"https://api.github.com/users/truncs/following{/other_user}","gists_url":"https://api.github.com/users/truncs/gists{/gist_id}","starred_url":"https://api.github.com/users/truncs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/truncs/subscriptions","organizations_url":"https://api.github.com/users/truncs/orgs","repos_url":"https://api.github.com/users/truncs/repos","events_url":"https://api.github.com/users/truncs/events{/privacy}","received_events_url":"https://api.github.com/users/truncs/received_events","type":"User","site_admin":false},"body":"this makes little sense for OSS, internal developers should pass the file path manually even if it means some boilerplate code.","created_at":"2015-09-23T05:19:34Z","updated_at":"2015-09-23T05:19:34Z","html_url":"https://github.com/uber/tchannel-java/pull/78#discussion_r40171598","pull_request_url":"https://api.github.com/repos/uber/tchannel-java/pulls/78","_links":{"self":{"href":"https://api.github.com/repos/uber/tchannel-java/pulls/comments/40171598"},"html":{"href":"https://github.com/uber/tchannel-java/pull/78#discussion_r40171598"},"pull_request":{"href":"https://api.github.com/repos/uber/tchannel-java/pulls/78"}}},"pull_request":{"url":"https://api.github.com/repos/uber/tchannel-java/pulls/78","id":45738948,"html_url":"https://github.com/uber/tchannel-java/pull/78","diff_url":"https://github.com/uber/tchannel-java/pull/78.diff","patch_url":"https://github.com/uber/tchannel-java/pull/78.patch","issue_url":"https://api.github.com/repos/uber/tchannel-java/issues/78","number":78,"state":"open","locked":false,"title":"hyperbahn client first pass","user":{"login":"willsalz","id":1295795,"avatar_url":"https://avatars.githubusercontent.com/u/1295795?v=3","gravatar_id":"","url":"https://api.github.com/users/willsalz","html_url":"https://github.com/willsalz","followers_url":"https://api.github.com/users/willsalz/followers","following_url":"https://api.github.com/users/willsalz/following{/other_user}","gists_url":"https://api.github.com/users/willsalz/gists{/gist_id}","starred_url":"https://api.github.com/users/willsalz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willsalz/subscriptions","organizations_url":"https://api.github.com/users/willsalz/orgs","repos_url":"https://api.github.com/users/willsalz/repos","events_url":"https://api.github.com/users/willsalz/events{/privacy}","received_events_url":"https://api.github.com/users/willsalz/received_events","type":"User","site_admin":false},"body":"What\r\n====\r\nReally basic Hyperbahn Client. Not yet 100% functioning due to TChannel bug #77 \r\n\r\nWhy\r\n====\r\nbecause hyperbahn. \r\n\r\nMisc\r\n====\r\n- Actually set the TTL on an outbound, oops.\r\n- return an empty header map if Gson returns null on parse ( that would happen if there were no headers )\r\n- Add a basic hyperbahn example\r\n- fix some aggressive renaming of example request handlers\r\n- implement basic hyperbahn client\r\n\r\nTodo\r\n====\r\n- Fix #77 \r\n- Perform a heartbeat with the Hyperbahn routers so we don't get disconnected\r\n- implement the exponential backoff strategy for connecting\r\n\r\ncc @truncs @brandoniles @junchaowu ","created_at":"2015-09-23T02:35:47Z","updated_at":"2015-09-23T05:19:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e500c6d614c1fddf7968c8bc8b255411dbe62505","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/uber/tchannel-java/pulls/78/commits","review_comments_url":"https://api.github.com/repos/uber/tchannel-java/pulls/78/comments","review_comment_url":"https://api.github.com/repos/uber/tchannel-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/uber/tchannel-java/issues/78/comments","statuses_url":"https://api.github.com/repos/uber/tchannel-java/statuses/8d04274b1b3403a209c3bf5bf5d913178f03f6d8","head":{"label":"uber:willsalz/hyperbahn-client","ref":"willsalz/hyperbahn-client","sha":"8d04274b1b3403a209c3bf5bf5d913178f03f6d8","user":{"login":"uber","id":538264,"avatar_url":"https://avatars.githubusercontent.com/u/538264?v=3","gravatar_id":"","url":"https://api.github.com/users/uber","html_url":"https://github.com/uber","followers_url":"https://api.github.com/users/uber/followers","following_url":"https://api.github.com/users/uber/following{/other_user}","gists_url":"https://api.github.com/users/uber/gists{/gist_id}","starred_url":"https://api.github.com/users/uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber/subscriptions","organizations_url":"https://api.github.com/users/uber/orgs","repos_url":"https://api.github.com/users/uber/repos","events_url":"https://api.github.com/users/uber/events{/privacy}","received_events_url":"https://api.github.com/users/uber/received_events","type":"Organization","site_admin":false},"repo":{"id":39764417,"name":"tchannel-java","full_name":"uber/tchannel-java","owner":{"login":"uber","id":538264,"avatar_url":"https://avatars.githubusercontent.com/u/538264?v=3","gravatar_id":"","url":"https://api.github.com/users/uber","html_url":"https://github.com/uber","followers_url":"https://api.github.com/users/uber/followers","following_url":"https://api.github.com/users/uber/following{/other_user}","gists_url":"https://api.github.com/users/uber/gists{/gist_id}","starred_url":"https://api.github.com/users/uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber/subscriptions","organizations_url":"https://api.github.com/users/uber/orgs","repos_url":"https://api.github.com/users/uber/repos","events_url":"https://api.github.com/users/uber/events{/privacy}","received_events_url":"https://api.github.com/users/uber/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/uber/tchannel-java","description":"A Java implementation of the TChannel protocol.","fork":false,"url":"https://api.github.com/repos/uber/tchannel-java","forks_url":"https://api.github.com/repos/uber/tchannel-java/forks","keys_url":"https://api.github.com/repos/uber/tchannel-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uber/tchannel-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uber/tchannel-java/teams","hooks_url":"https://api.github.com/repos/uber/tchannel-java/hooks","issue_events_url":"https://api.github.com/repos/uber/tchannel-java/issues/events{/number}","events_url":"https://api.github.com/repos/uber/tchannel-java/events","assignees_url":"https://api.github.com/repos/uber/tchannel-java/assignees{/user}","branches_url":"https://api.github.com/repos/uber/tchannel-java/branches{/branch}","tags_url":"https://api.github.com/repos/uber/tchannel-java/tags","blobs_url":"https://api.github.com/repos/uber/tchannel-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uber/tchannel-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uber/tchannel-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/uber/tchannel-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uber/tchannel-java/statuses/{sha}","languages_url":"https://api.github.com/repos/uber/tchannel-java/languages","stargazers_url":"https://api.github.com/repos/uber/tchannel-java/stargazers","contributors_url":"https://api.github.com/repos/uber/tchannel-java/contributors","subscribers_url":"https://api.github.com/repos/uber/tchannel-java/subscribers","subscription_url":"https://api.github.com/repos/uber/tchannel-java/subscription","commits_url":"https://api.github.com/repos/uber/tchannel-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/uber/tchannel-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/uber/tchannel-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/uber/tchannel-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/uber/tchannel-java/contents/{+path}","compare_url":"https://api.github.com/repos/uber/tchannel-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uber/tchannel-java/merges","archive_url":"https://api.github.com/repos/uber/tchannel-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uber/tchannel-java/downloads","issues_url":"https://api.github.com/repos/uber/tchannel-java/issues{/number}","pulls_url":"https://api.github.com/repos/uber/tchannel-java/pulls{/number}","milestones_url":"https://api.github.com/repos/uber/tchannel-java/milestones{/number}","notifications_url":"https://api.github.com/repos/uber/tchannel-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uber/tchannel-java/labels{/name}","releases_url":"https://api.github.com/repos/uber/tchannel-java/releases{/id}","created_at":"2015-07-27T08:49:33Z","updated_at":"2015-09-16T22:32:14Z","pushed_at":"2015-09-23T02:35:48Z","git_url":"git://github.com/uber/tchannel-java.git","ssh_url":"git@github.com:uber/tchannel-java.git","clone_url":"https://github.com/uber/tchannel-java.git","svn_url":"https://github.com/uber/tchannel-java","homepage":"","size":1112,"stargazers_count":25,"watchers_count":25,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":21,"forks":9,"open_issues":21,"watchers":25,"default_branch":"master"}},"base":{"label":"uber:master","ref":"master","sha":"42d5986f1e3b8ad1635313ddb80ea4fd799ac491","user":{"login":"uber","id":538264,"avatar_url":"https://avatars.githubusercontent.com/u/538264?v=3","gravatar_id":"","url":"https://api.github.com/users/uber","html_url":"https://github.com/uber","followers_url":"https://api.github.com/users/uber/followers","following_url":"https://api.github.com/users/uber/following{/other_user}","gists_url":"https://api.github.com/users/uber/gists{/gist_id}","starred_url":"https://api.github.com/users/uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber/subscriptions","organizations_url":"https://api.github.com/users/uber/orgs","repos_url":"https://api.github.com/users/uber/repos","events_url":"https://api.github.com/users/uber/events{/privacy}","received_events_url":"https://api.github.com/users/uber/received_events","type":"Organization","site_admin":false},"repo":{"id":39764417,"name":"tchannel-java","full_name":"uber/tchannel-java","owner":{"login":"uber","id":538264,"avatar_url":"https://avatars.githubusercontent.com/u/538264?v=3","gravatar_id":"","url":"https://api.github.com/users/uber","html_url":"https://github.com/uber","followers_url":"https://api.github.com/users/uber/followers","following_url":"https://api.github.com/users/uber/following{/other_user}","gists_url":"https://api.github.com/users/uber/gists{/gist_id}","starred_url":"https://api.github.com/users/uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber/subscriptions","organizations_url":"https://api.github.com/users/uber/orgs","repos_url":"https://api.github.com/users/uber/repos","events_url":"https://api.github.com/users/uber/events{/privacy}","received_events_url":"https://api.github.com/users/uber/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/uber/tchannel-java","description":"A Java implementation of the TChannel protocol.","fork":false,"url":"https://api.github.com/repos/uber/tchannel-java","forks_url":"https://api.github.com/repos/uber/tchannel-java/forks","keys_url":"https://api.github.com/repos/uber/tchannel-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uber/tchannel-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uber/tchannel-java/teams","hooks_url":"https://api.github.com/repos/uber/tchannel-java/hooks","issue_events_url":"https://api.github.com/repos/uber/tchannel-java/issues/events{/number}","events_url":"https://api.github.com/repos/uber/tchannel-java/events","assignees_url":"https://api.github.com/repos/uber/tchannel-java/assignees{/user}","branches_url":"https://api.github.com/repos/uber/tchannel-java/branches{/branch}","tags_url":"https://api.github.com/repos/uber/tchannel-java/tags","blobs_url":"https://api.github.com/repos/uber/tchannel-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uber/tchannel-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uber/tchannel-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/uber/tchannel-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uber/tchannel-java/statuses/{sha}","languages_url":"https://api.github.com/repos/uber/tchannel-java/languages","stargazers_url":"https://api.github.com/repos/uber/tchannel-java/stargazers","contributors_url":"https://api.github.com/repos/uber/tchannel-java/contributors","subscribers_url":"https://api.github.com/repos/uber/tchannel-java/subscribers","subscription_url":"https://api.github.com/repos/uber/tchannel-java/subscription","commits_url":"https://api.github.com/repos/uber/tchannel-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/uber/tchannel-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/uber/tchannel-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/uber/tchannel-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/uber/tchannel-java/contents/{+path}","compare_url":"https://api.github.com/repos/uber/tchannel-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uber/tchannel-java/merges","archive_url":"https://api.github.com/repos/uber/tchannel-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uber/tchannel-java/downloads","issues_url":"https://api.github.com/repos/uber/tchannel-java/issues{/number}","pulls_url":"https://api.github.com/repos/uber/tchannel-java/pulls{/number}","milestones_url":"https://api.github.com/repos/uber/tchannel-java/milestones{/number}","notifications_url":"https://api.github.com/repos/uber/tchannel-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uber/tchannel-java/labels{/name}","releases_url":"https://api.github.com/repos/uber/tchannel-java/releases{/id}","created_at":"2015-07-27T08:49:33Z","updated_at":"2015-09-16T22:32:14Z","pushed_at":"2015-09-23T02:35:48Z","git_url":"git://github.com/uber/tchannel-java.git","ssh_url":"git@github.com:uber/tchannel-java.git","clone_url":"https://github.com/uber/tchannel-java.git","svn_url":"https://github.com/uber/tchannel-java","homepage":"","size":1112,"stargazers_count":25,"watchers_count":25,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":21,"forks":9,"open_issues":21,"watchers":25,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/uber/tchannel-java/pulls/78"},"html":{"href":"https://github.com/uber/tchannel-java/pull/78"},"issue":{"href":"https://api.github.com/repos/uber/tchannel-java/issues/78"},"comments":{"href":"https://api.github.com/repos/uber/tchannel-java/issues/78/comments"},"review_comments":{"href":"https://api.github.com/repos/uber/tchannel-java/pulls/78/comments"},"review_comment":{"href":"https://api.github.com/repos/uber/tchannel-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/uber/tchannel-java/pulls/78/commits"},"statuses":{"href":"https://api.github.com/repos/uber/tchannel-java/statuses/8d04274b1b3403a209c3bf5bf5d913178f03f6d8"}}}}