{"action":"created","comment":{"url":"https://api.github.com/repos/mp911de/logstash-gelf/pulls/comments/53555131","id":53555131,"diff_hunk":"@@ -0,0 +1,85 @@\n+package biz.paluch.logging.gelf.intern.sender;\n+\n+import biz.paluch.logging.gelf.intern.ErrorReporter;\n+import biz.paluch.logging.gelf.intern.GelfMessage;\n+import org.apache.http.ProtocolVersion;\n+import org.apache.http.client.methods.CloseableHttpResponse;\n+import org.apache.http.client.methods.HttpPost;\n+import org.apache.http.client.methods.HttpUriRequest;\n+import org.apache.http.impl.client.CloseableHttpClient;\n+import org.apache.http.impl.client.HttpClientBuilder;\n+import org.apache.http.message.BasicStatusLine;\n+import org.apache.http.util.EntityUtils;\n+import org.junit.Before;\n+import org.junit.Test;\n+import org.mockito.ArgumentCaptor;\n+import org.mockito.Mock;\n+import org.mockito.MockitoAnnotations;\n+\n+import java.io.IOException;\n+\n+import static org.junit.Assert.assertEquals;\n+import static org.junit.Assert.assertFalse;\n+import static org.junit.Assert.assertTrue;\n+import static org.mockito.Matchers.any;\n+import static org.mockito.Mockito.*;\n+\n+/**\n+ * (c) Alekandar - https://github.com/salex89\n+ */\n+\n+public class GelfHTTPSenderTest {\n+\n+\n+    @Mock\n+    HttpClientBuilder builder;\n+    @Mock\n+    CloseableHttpClient closeableHttpClient;\n+    @Mock\n+    CloseableHttpResponse closeableHttpResponse;\n+    @Mock\n+    ErrorReporter errorReporter;\n+\n+    @Before\n+    public void prepareMocks() throws IOException {\n+        MockitoAnnotations.initMocks(this);\n+//        when(closeableHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion(\"HTTP\", 1, 1), 202, \"Accepted\"));","path":"src/test/java/biz/paluch/logging/gelf/intern/sender/GelfHTTPSenderTest.java","position":46,"original_position":46,"commit_id":"3546aba9611203553242dcf0756f17e87f8fe3f7","original_commit_id":"3546aba9611203553242dcf0756f17e87f8fe3f7","user":{"login":"mp911de","id":1035015,"avatar_url":"https://avatars.githubusercontent.com/u/1035015?v=3","gravatar_id":"","url":"https://api.github.com/users/mp911de","html_url":"https://github.com/mp911de","followers_url":"https://api.github.com/users/mp911de/followers","following_url":"https://api.github.com/users/mp911de/following{/other_user}","gists_url":"https://api.github.com/users/mp911de/gists{/gist_id}","starred_url":"https://api.github.com/users/mp911de/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mp911de/subscriptions","organizations_url":"https://api.github.com/users/mp911de/orgs","repos_url":"https://api.github.com/users/mp911de/repos","events_url":"https://api.github.com/users/mp911de/events{/privacy}","received_events_url":"https://api.github.com/users/mp911de/received_events","type":"User","site_admin":false},"body":"An integration test with the sender would be great. Netty is already on the class-path, you can build your own HTTP server, see https://github.com/netty/netty/tree/4.0/example/src/main/java/io/netty/example/http/helloworld","created_at":"2016-02-20T18:41:03Z","updated_at":"2016-02-20T18:41:03Z","html_url":"https://github.com/mp911de/logstash-gelf/pull/68#discussion_r53555131","pull_request_url":"https://api.github.com/repos/mp911de/logstash-gelf/pulls/68","_links":{"self":{"href":"https://api.github.com/repos/mp911de/logstash-gelf/pulls/comments/53555131"},"html":{"href":"https://github.com/mp911de/logstash-gelf/pull/68#discussion_r53555131"},"pull_request":{"href":"https://api.github.com/repos/mp911de/logstash-gelf/pulls/68"}}},"pull_request":{"url":"https://api.github.com/repos/mp911de/logstash-gelf/pulls/68","id":60017022,"html_url":"https://github.com/mp911de/logstash-gelf/pull/68","diff_url":"https://github.com/mp911de/logstash-gelf/pull/68.diff","patch_url":"https://github.com/mp911de/logstash-gelf/pull/68.patch","issue_url":"https://api.github.com/repos/mp911de/logstash-gelf/issues/68","number":68,"state":"open","locked":false,"title":"Added GelfHTTPSender","user":{"login":"salex89","id":2933672,"avatar_url":"https://avatars.githubusercontent.com/u/2933672?v=3","gravatar_id":"","url":"https://api.github.com/users/salex89","html_url":"https://github.com/salex89","followers_url":"https://api.github.com/users/salex89/followers","following_url":"https://api.github.com/users/salex89/following{/other_user}","gists_url":"https://api.github.com/users/salex89/gists{/gist_id}","starred_url":"https://api.github.com/users/salex89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/salex89/subscriptions","organizations_url":"https://api.github.com/users/salex89/orgs","repos_url":"https://api.github.com/users/salex89/repos","events_url":"https://api.github.com/users/salex89/events{/privacy}","received_events_url":"https://api.github.com/users/salex89/received_events","type":"User","site_admin":false},"body":"#### Outline\r\nAdded HTTP Sender, for situations when the log manager is on a remote location or behind a proxy. Currently TLS and authentication is not supported, only log submission. TLS is the next step.\r\n\r\n#### Motivation\r\nThe motivation is to use Graylog for remote logging, with Android devices, IoT and such.\r\n\r\n#### Added configuration\r\nAs for the HTTP sender configuration, the host is the complete path to the log manager (i.e Graylog) endpoint, like `http://192.168.0.1:12201/gelf` . If the port is not added to the host, the one supplied in the configuration file will be inserted into the host. I would gladly document this example, when I am informed where to put it :-) .\r\n\r\n#### Questions and issues\r\nRegarding TLS and auth, additional configuration is needed (not sure which fields for now). I would like to consult with the author, which is the best way to do it? Should new configuration fields be added, available in all of the formats, hence, modifying all of the parsers, or some other way? I have noticed that the `GelfSenderConfiguration` has the method `Map<String, Object> getSpecificConfigurations();`, and I suppose this is the way to go, based on the design. However, no example is provided how is this bound to the configuration files, and I'm not sure is it.\r\n\r\nLooking forward to continuing this,\r\nAleksandar","created_at":"2016-02-19T22:27:59Z","updated_at":"2016-02-20T18:41:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":{"login":"mp911de","id":1035015,"avatar_url":"https://avatars.githubusercontent.com/u/1035015?v=3","gravatar_id":"","url":"https://api.github.com/users/mp911de","html_url":"https://github.com/mp911de","followers_url":"https://api.github.com/users/mp911de/followers","following_url":"https://api.github.com/users/mp911de/following{/other_user}","gists_url":"https://api.github.com/users/mp911de/gists{/gist_id}","starred_url":"https://api.github.com/users/mp911de/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mp911de/subscriptions","organizations_url":"https://api.github.com/users/mp911de/orgs","repos_url":"https://api.github.com/users/mp911de/repos","events_url":"https://api.github.com/users/mp911de/events{/privacy}","received_events_url":"https://api.github.com/users/mp911de/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/mp911de/logstash-gelf/pulls/68/commits","review_comments_url":"https://api.github.com/repos/mp911de/logstash-gelf/pulls/68/comments","review_comment_url":"https://api.github.com/repos/mp911de/logstash-gelf/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mp911de/logstash-gelf/issues/68/comments","statuses_url":"https://api.github.com/repos/mp911de/logstash-gelf/statuses/3546aba9611203553242dcf0756f17e87f8fe3f7","head":{"label":"salex89:dev-HTTPSender","ref":"dev-HTTPSender","sha":"3546aba9611203553242dcf0756f17e87f8fe3f7","user":{"login":"salex89","id":2933672,"avatar_url":"https://avatars.githubusercontent.com/u/2933672?v=3","gravatar_id":"","url":"https://api.github.com/users/salex89","html_url":"https://github.com/salex89","followers_url":"https://api.github.com/users/salex89/followers","following_url":"https://api.github.com/users/salex89/following{/other_user}","gists_url":"https://api.github.com/users/salex89/gists{/gist_id}","starred_url":"https://api.github.com/users/salex89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/salex89/subscriptions","organizations_url":"https://api.github.com/users/salex89/orgs","repos_url":"https://api.github.com/users/salex89/repos","events_url":"https://api.github.com/users/salex89/events{/privacy}","received_events_url":"https://api.github.com/users/salex89/received_events","type":"User","site_admin":false},"repo":{"id":49818124,"name":"logstash-gelf","full_name":"salex89/logstash-gelf","owner":{"login":"salex89","id":2933672,"avatar_url":"https://avatars.githubusercontent.com/u/2933672?v=3","gravatar_id":"","url":"https://api.github.com/users/salex89","html_url":"https://github.com/salex89","followers_url":"https://api.github.com/users/salex89/followers","following_url":"https://api.github.com/users/salex89/following{/other_user}","gists_url":"https://api.github.com/users/salex89/gists{/gist_id}","starred_url":"https://api.github.com/users/salex89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/salex89/subscriptions","organizations_url":"https://api.github.com/users/salex89/orgs","repos_url":"https://api.github.com/users/salex89/repos","events_url":"https://api.github.com/users/salex89/events{/privacy}","received_events_url":"https://api.github.com/users/salex89/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/salex89/logstash-gelf","description":"Graylog Extended Log Format (GELF) implementation in Java for all major logging frameworks: log4j, log4j2, java.util.logging, logback, JBossAS7 and WildFly 8-10","fork":true,"url":"https://api.github.com/repos/salex89/logstash-gelf","forks_url":"https://api.github.com/repos/salex89/logstash-gelf/forks","keys_url":"https://api.github.com/repos/salex89/logstash-gelf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/salex89/logstash-gelf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/salex89/logstash-gelf/teams","hooks_url":"https://api.github.com/repos/salex89/logstash-gelf/hooks","issue_events_url":"https://api.github.com/repos/salex89/logstash-gelf/issues/events{/number}","events_url":"https://api.github.com/repos/salex89/logstash-gelf/events","assignees_url":"https://api.github.com/repos/salex89/logstash-gelf/assignees{/user}","branches_url":"https://api.github.com/repos/salex89/logstash-gelf/branches{/branch}","tags_url":"https://api.github.com/repos/salex89/logstash-gelf/tags","blobs_url":"https://api.github.com/repos/salex89/logstash-gelf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/salex89/logstash-gelf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/salex89/logstash-gelf/git/refs{/sha}","trees_url":"https://api.github.com/repos/salex89/logstash-gelf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/salex89/logstash-gelf/statuses/{sha}","languages_url":"https://api.github.com/repos/salex89/logstash-gelf/languages","stargazers_url":"https://api.github.com/repos/salex89/logstash-gelf/stargazers","contributors_url":"https://api.github.com/repos/salex89/logstash-gelf/contributors","subscribers_url":"https://api.github.com/repos/salex89/logstash-gelf/subscribers","subscription_url":"https://api.github.com/repos/salex89/logstash-gelf/subscription","commits_url":"https://api.github.com/repos/salex89/logstash-gelf/commits{/sha}","git_commits_url":"https://api.github.com/repos/salex89/logstash-gelf/git/commits{/sha}","comments_url":"https://api.github.com/repos/salex89/logstash-gelf/comments{/number}","issue_comment_url":"https://api.github.com/repos/salex89/logstash-gelf/issues/comments{/number}","contents_url":"https://api.github.com/repos/salex89/logstash-gelf/contents/{+path}","compare_url":"https://api.github.com/repos/salex89/logstash-gelf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/salex89/logstash-gelf/merges","archive_url":"https://api.github.com/repos/salex89/logstash-gelf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/salex89/logstash-gelf/downloads","issues_url":"https://api.github.com/repos/salex89/logstash-gelf/issues{/number}","pulls_url":"https://api.github.com/repos/salex89/logstash-gelf/pulls{/number}","milestones_url":"https://api.github.com/repos/salex89/logstash-gelf/milestones{/number}","notifications_url":"https://api.github.com/repos/salex89/logstash-gelf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/salex89/logstash-gelf/labels{/name}","releases_url":"https://api.github.com/repos/salex89/logstash-gelf/releases{/id}","deployments_url":"https://api.github.com/repos/salex89/logstash-gelf/deployments","created_at":"2016-01-17T13:23:05Z","updated_at":"2016-01-17T13:23:06Z","pushed_at":"2016-02-19T22:27:11Z","git_url":"git://github.com/salex89/logstash-gelf.git","ssh_url":"git@github.com:salex89/logstash-gelf.git","clone_url":"https://github.com/salex89/logstash-gelf.git","svn_url":"https://github.com/salex89/logstash-gelf","homepage":"http://logging.paluch.biz","size":676,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mp911de:master","ref":"master","sha":"5cfef4f080bfecabd8f27c84dcfe7027b0848bfb","user":{"login":"mp911de","id":1035015,"avatar_url":"https://avatars.githubusercontent.com/u/1035015?v=3","gravatar_id":"","url":"https://api.github.com/users/mp911de","html_url":"https://github.com/mp911de","followers_url":"https://api.github.com/users/mp911de/followers","following_url":"https://api.github.com/users/mp911de/following{/other_user}","gists_url":"https://api.github.com/users/mp911de/gists{/gist_id}","starred_url":"https://api.github.com/users/mp911de/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mp911de/subscriptions","organizations_url":"https://api.github.com/users/mp911de/orgs","repos_url":"https://api.github.com/users/mp911de/repos","events_url":"https://api.github.com/users/mp911de/events{/privacy}","received_events_url":"https://api.github.com/users/mp911de/received_events","type":"User","site_admin":false},"repo":{"id":13122373,"name":"logstash-gelf","full_name":"mp911de/logstash-gelf","owner":{"login":"mp911de","id":1035015,"avatar_url":"https://avatars.githubusercontent.com/u/1035015?v=3","gravatar_id":"","url":"https://api.github.com/users/mp911de","html_url":"https://github.com/mp911de","followers_url":"https://api.github.com/users/mp911de/followers","following_url":"https://api.github.com/users/mp911de/following{/other_user}","gists_url":"https://api.github.com/users/mp911de/gists{/gist_id}","starred_url":"https://api.github.com/users/mp911de/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mp911de/subscriptions","organizations_url":"https://api.github.com/users/mp911de/orgs","repos_url":"https://api.github.com/users/mp911de/repos","events_url":"https://api.github.com/users/mp911de/events{/privacy}","received_events_url":"https://api.github.com/users/mp911de/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mp911de/logstash-gelf","description":"Graylog Extended Log Format (GELF) implementation in Java for all major logging frameworks: log4j, log4j2, java.util.logging, logback, JBossAS7 and WildFly 8-10","fork":false,"url":"https://api.github.com/repos/mp911de/logstash-gelf","forks_url":"https://api.github.com/repos/mp911de/logstash-gelf/forks","keys_url":"https://api.github.com/repos/mp911de/logstash-gelf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mp911de/logstash-gelf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mp911de/logstash-gelf/teams","hooks_url":"https://api.github.com/repos/mp911de/logstash-gelf/hooks","issue_events_url":"https://api.github.com/repos/mp911de/logstash-gelf/issues/events{/number}","events_url":"https://api.github.com/repos/mp911de/logstash-gelf/events","assignees_url":"https://api.github.com/repos/mp911de/logstash-gelf/assignees{/user}","branches_url":"https://api.github.com/repos/mp911de/logstash-gelf/branches{/branch}","tags_url":"https://api.github.com/repos/mp911de/logstash-gelf/tags","blobs_url":"https://api.github.com/repos/mp911de/logstash-gelf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mp911de/logstash-gelf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mp911de/logstash-gelf/git/refs{/sha}","trees_url":"https://api.github.com/repos/mp911de/logstash-gelf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mp911de/logstash-gelf/statuses/{sha}","languages_url":"https://api.github.com/repos/mp911de/logstash-gelf/languages","stargazers_url":"https://api.github.com/repos/mp911de/logstash-gelf/stargazers","contributors_url":"https://api.github.com/repos/mp911de/logstash-gelf/contributors","subscribers_url":"https://api.github.com/repos/mp911de/logstash-gelf/subscribers","subscription_url":"https://api.github.com/repos/mp911de/logstash-gelf/subscription","commits_url":"https://api.github.com/repos/mp911de/logstash-gelf/commits{/sha}","git_commits_url":"https://api.github.com/repos/mp911de/logstash-gelf/git/commits{/sha}","comments_url":"https://api.github.com/repos/mp911de/logstash-gelf/comments{/number}","issue_comment_url":"https://api.github.com/repos/mp911de/logstash-gelf/issues/comments{/number}","contents_url":"https://api.github.com/repos/mp911de/logstash-gelf/contents/{+path}","compare_url":"https://api.github.com/repos/mp911de/logstash-gelf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mp911de/logstash-gelf/merges","archive_url":"https://api.github.com/repos/mp911de/logstash-gelf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mp911de/logstash-gelf/downloads","issues_url":"https://api.github.com/repos/mp911de/logstash-gelf/issues{/number}","pulls_url":"https://api.github.com/repos/mp911de/logstash-gelf/pulls{/number}","milestones_url":"https://api.github.com/repos/mp911de/logstash-gelf/milestones{/number}","notifications_url":"https://api.github.com/repos/mp911de/logstash-gelf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mp911de/logstash-gelf/labels{/name}","releases_url":"https://api.github.com/repos/mp911de/logstash-gelf/releases{/id}","deployments_url":"https://api.github.com/repos/mp911de/logstash-gelf/deployments","created_at":"2013-09-26T12:57:31Z","updated_at":"2016-02-16T13:16:34Z","pushed_at":"2016-02-19T22:27:59Z","git_url":"git://github.com/mp911de/logstash-gelf.git","ssh_url":"git@github.com:mp911de/logstash-gelf.git","clone_url":"https://github.com/mp911de/logstash-gelf.git","svn_url":"https://github.com/mp911de/logstash-gelf","homepage":"http://logging.paluch.biz","size":690,"stargazers_count":54,"watchers_count":54,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":3,"forks":17,"open_issues":3,"watchers":54,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mp911de/logstash-gelf/pulls/68"},"html":{"href":"https://github.com/mp911de/logstash-gelf/pull/68"},"issue":{"href":"https://api.github.com/repos/mp911de/logstash-gelf/issues/68"},"comments":{"href":"https://api.github.com/repos/mp911de/logstash-gelf/issues/68/comments"},"review_comments":{"href":"https://api.github.com/repos/mp911de/logstash-gelf/pulls/68/comments"},"review_comment":{"href":"https://api.github.com/repos/mp911de/logstash-gelf/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mp911de/logstash-gelf/pulls/68/commits"},"statuses":{"href":"https://api.github.com/repos/mp911de/logstash-gelf/statuses/3546aba9611203553242dcf0756f17e87f8fe3f7"}}}}