{"action":"created","issue":{"url":"https://api.github.com/repos/tomakehurst/wiremock/issues/132","repository_url":"https://api.github.com/repos/tomakehurst/wiremock","labels_url":"https://api.github.com/repos/tomakehurst/wiremock/issues/132/labels{/name}","comments_url":"https://api.github.com/repos/tomakehurst/wiremock/issues/132/comments","events_url":"https://api.github.com/repos/tomakehurst/wiremock/issues/132/events","html_url":"https://github.com/tomakehurst/wiremock/issues/132","id":32407840,"number":132,"title":"Unexpected end of file from server exception when several test methods within one class","user":{"login":"tongguop","id":1868471,"avatar_url":"https://avatars.githubusercontent.com/u/1868471?v=3","gravatar_id":"","url":"https://api.github.com/users/tongguop","html_url":"https://github.com/tongguop","followers_url":"https://api.github.com/users/tongguop/followers","following_url":"https://api.github.com/users/tongguop/following{/other_user}","gists_url":"https://api.github.com/users/tongguop/gists{/gist_id}","starred_url":"https://api.github.com/users/tongguop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tongguop/subscriptions","organizations_url":"https://api.github.com/users/tongguop/orgs","repos_url":"https://api.github.com/users/tongguop/repos","events_url":"https://api.github.com/users/tongguop/events{/privacy}","received_events_url":"https://api.github.com/users/tongguop/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":28,"created_at":"2014-04-28T23:21:24Z","updated_at":"2016-09-01T08:05:00Z","closed_at":"2014-05-09T13:22:48Z","body":"This doesn't seem to be a problem on my own computer. However when I run the maven build on Jenkins, it always fails with the following message:\r\nCaused by: java.net.SocketException: SocketException invoking http://localhost:8098/some/useless/path: Unexpected end of file from server.\r\n\r\nI searched Wiremock's config, it doesn't seem that I can change the server timeout settings."},"comment":{"url":"https://api.github.com/repos/tomakehurst/wiremock/issues/comments/244006140","html_url":"https://github.com/tomakehurst/wiremock/issues/132#issuecomment-244006140","issue_url":"https://api.github.com/repos/tomakehurst/wiremock/issues/132","id":244006140,"user":{"login":"trzaszcs","id":756517,"avatar_url":"https://avatars.githubusercontent.com/u/756517?v=3","gravatar_id":"","url":"https://api.github.com/users/trzaszcs","html_url":"https://github.com/trzaszcs","followers_url":"https://api.github.com/users/trzaszcs/followers","following_url":"https://api.github.com/users/trzaszcs/following{/other_user}","gists_url":"https://api.github.com/users/trzaszcs/gists{/gist_id}","starred_url":"https://api.github.com/users/trzaszcs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trzaszcs/subscriptions","organizations_url":"https://api.github.com/users/trzaszcs/orgs","repos_url":"https://api.github.com/users/trzaszcs/repos","events_url":"https://api.github.com/users/trzaszcs/events{/privacy}","received_events_url":"https://api.github.com/users/trzaszcs/received_events","type":"User","site_admin":false},"created_at":"2016-09-01T08:05:00Z","updated_at":"2016-09-01T08:05:00Z","body":"It looks like race condition.\r\n\r\nI have 2 tests.\r\n\r\n1 test invokes Rest endpoint that calls WM\r\n\r\n2 test:\r\n\r\n`class ChangePriceEndpointIntegrationSpec extends Specification {\r\n\r\n    @Rule\r\n    WireMockRule wireMockRule = new WireMockRule(12346)\r\n\r\n    def \"should handle event\"() {\r\n        given:\r\n        // here is stub\r\n        stubFor(put(urlEqualTo(\"/some\"))\r\n                .willReturn(aResponse().withStatus(200)\r\n                .withHeader(\"Content-Type\", \"application/json\")\r\n                .withBody(\"\"\"{\"value\":\"123456\"}\"\"\")))\r\n\r\n        // init client\r\n        RestTemplate restTemplate = new RestTemplate()\r\n        MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();\r\n        headers.put(HttpHeaders.ACCEPT, Lists.newArrayList(\"application/json\"));\r\n        RequestEntity<ChangePriceDto> request = new RequestEntity<>(new ChangePriceDto(), headers, HttpMethod.PUT, new URI(\"http://localhost:12346/some\"))\r\n\r\n//        sleep(5000)\r\n\r\n        when:\r\n        2.times {\r\n            try {\r\n                println restTemplate.exchange(request, JobIdDto.class);\r\n            } catch (Exception ex) {\r\n                println \"failure ${ex}\"\r\n            }\r\n        }\r\n        then:\r\n        \"OK\"\r\n    }\r\n\r\n}`\r\n\r\n\r\nFirst call fails, second is fine. If you add sleep(5000) both calls are working.\r\n\r\nMost intereting part are logs. I don't know WM so good so maybe You can help me with that\r\n\r\n> 10:00:59.968 [main] INFO  o.e.jetty.server.ServerConnector - Started ServerConnector@48697181{HTTP/1.1}{0.0.0.0:12346}\r\n> 10:00:59.970 [main] INFO  org.eclipse.jetty.server.Server - Started @13654ms\r\n> 10:00:59.978 [qtp237594516-40] INFO  /__admin - RequestHandlerClass from context returned com.github.tomakehurst.wiremock.http.AdminRequestHandler. Normalized mapped under returned 'null'\r\n> failure org.springframework.web.client.ResourceAccessException: I/O error on PUT request for \"http://localhost:12346/some\": Unexpected end of file from server; nested exception is java.net.SocketException: Unexpected end of file from server\r\n> 10:01:00.057 [qtp237594516-41] INFO  / - RequestHandlerClass from context returned com.github.tomakehurst.wiremock.http.StubRequestHandler. Normalized mapped under returned 'null'\r\n> <200 OK,JobIdDto{value='123456'},{Content-Type=[application/json], Transfer-Encoding=[chunked], Server=[Jetty(9.2.13.v20150730)]}>\r\n> 10:01:00.093 [main] INFO  o.e.jetty.server.ServerConnector - Stopped ServerConnector@48697181{HTTP/1.1}{0.0.0.0:12346}\r\n\r\n\r\nInteresting is this entry :\r\n\r\n> 10:01:00.057 [qtp237594516-41] INFO  / - RequestHandlerClass from context returned com.github.tomakehurst.wiremock.http.StubRequestHandler. Normalized mapped under returned 'null'\r\n\r\nIt occurs just after failure ...\r\n\r\n"}}
{"actor":{"display_login":"trzaszcs"}}