{"action":"created","issue":{"url":"https://api.github.com/repos/square/okhttp/issues/2621","repository_url":"https://api.github.com/repos/square/okhttp","labels_url":"https://api.github.com/repos/square/okhttp/issues/2621/labels{/name}","comments_url":"https://api.github.com/repos/square/okhttp/issues/2621/comments","events_url":"https://api.github.com/repos/square/okhttp/issues/2621/events","html_url":"https://github.com/square/okhttp/issues/2621","id":160002994,"number":2621,"title":"MockWebServer timeout issues","user":{"login":"jaredsburrows","id":1739848,"avatar_url":"https://avatars.githubusercontent.com/u/1739848?v=3","gravatar_id":"","url":"https://api.github.com/users/jaredsburrows","html_url":"https://github.com/jaredsburrows","followers_url":"https://api.github.com/users/jaredsburrows/followers","following_url":"https://api.github.com/users/jaredsburrows/following{/other_user}","gists_url":"https://api.github.com/users/jaredsburrows/gists{/gist_id}","starred_url":"https://api.github.com/users/jaredsburrows/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaredsburrows/subscriptions","organizations_url":"https://api.github.com/users/jaredsburrows/orgs","repos_url":"https://api.github.com/users/jaredsburrows/repos","events_url":"https://api.github.com/users/jaredsburrows/events{/privacy}","received_events_url":"https://api.github.com/users/jaredsburrows/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-06-13T17:27:17Z","updated_at":"2016-06-25T19:05:40Z","closed_at":null,"body":"# MockWebServer timeout issue\r\nSince I have upgraded from `3.2.0` to `3.3.1`, our CI has timed out while using the `MockWebServer`. \r\n\r\n# Code:\r\n\r\nThe test case is similar to: https://github.com/JakeWharton/retrofit1-okhttp3-client/blob/master/src/test/java/com/jakewharton/retrofit/Ok3ClientIntegrationTest.java#L23.\r\n\r\n```\r\npublic final class ServiceTest {\r\n\r\n    @Rule public final MockWebServer server = new MockWebServer();\r\n    protected String mockEndPoint;\r\n\r\n    @Before\r\n    public void setUp() throws Exception {\r\n        mockEndPoint = server.url(\"/\").toString();\r\n    }\r\n\r\n    @After\r\n    public void tearDown() throws Exception {\r\n    }\r\n\r\n    @Test\r\n    public void testAcquireToken() {\r\n        // Response\r\n        final String mockResponse = \"{\\n\" +\r\n                \"  \\\"access_token\\\": \\\"\" + TOKEN_VALID + \"\\\",\\n\" +\r\n                \"  \\\"refresh_token\\\": \\\"\" + TOKEN_VALID + \"\\\",\\n\" +\r\n                \"  \\\"token_type\\\": \\\"bearer\\\",\\n\" +\r\n                \"  \\\"expires_in\\\": 3600,\\n\" +\r\n                \"  \\\"logout_token\\\": \\\"r0ZZSZDVbUma9sTz0ZXduwvic1V7RdSIZMe\\\\/ysHTY8s=\\\"\\n\" +\r\n                \"}\";\r\n\r\n        server.enqueue(new MockResponse()\r\n                .setResponseCode(HttpURLConnection.HTTP_OK)\r\n                .setBody(mockResponse));\r\n\r\n        // Request\r\n        final Map<String, String> formData = new HashMap<>();\r\n        formData.put(\"grant_type\", \"password\");\r\n        formData.put(\"client_id\", \"fake-id\");\r\n        formData.put(\"client_secret\", \"fake-secret\");\r\n        formData.put(\"username\", \"user EMAIL\");\r\n        formData.put(\"password\", \"user PASSWORD\");\r\n\r\n        final TokenResponse response = Service.getInstance(mockEndPoint)\r\n                .acquireToken(formData)\r\n                .toBlocking()\r\n                .first();\r\n\r\n        assertThat(response.getAccessToken()).isEqualTo(\"valid\");\r\n    }\r\n}\r\n```\r\n\r\n# Error:\r\n```\r\n19:44:09 <>Test > testAcquireToken STANDARD_ERROR\r\n19:44:09     Jun 10, 2016 12:45:41 PM okhttp3.mockwebserver.MockWebServer$3 execute\r\n19:44:09     INFO: MockWebServer[63326] starting to accept connections\r\n19:44:09     Jun 10, 2016 12:45:41 PM okhttp3.mockwebserver.MockWebServer$4 processOneRequest\r\n19:44:09     INFO: MockWebServer[63326] received request: POST /auth/v1/token HTTP/1.1 and responded: HTTP/1.1 200 OK\r\n19:44:09     Jun 10, 2016 12:45:41 PM okhttp3.mockwebserver.MockWebServer$3 acceptConnections\r\n19:44:09     INFO: MockWebServer[63326] done accepting connections: Socket closed\r\n20:09:59 Build timed out (after 30 minutes). Marking the build as failed.\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/square/okhttp/issues/comments/228565388","html_url":"https://github.com/square/okhttp/issues/2621#issuecomment-228565388","issue_url":"https://api.github.com/repos/square/okhttp/issues/2621","id":228565388,"user":{"login":"swankjesse","id":133019,"avatar_url":"https://avatars.githubusercontent.com/u/133019?v=3","gravatar_id":"","url":"https://api.github.com/users/swankjesse","html_url":"https://github.com/swankjesse","followers_url":"https://api.github.com/users/swankjesse/followers","following_url":"https://api.github.com/users/swankjesse/following{/other_user}","gists_url":"https://api.github.com/users/swankjesse/gists{/gist_id}","starred_url":"https://api.github.com/users/swankjesse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swankjesse/subscriptions","organizations_url":"https://api.github.com/users/swankjesse/orgs","repos_url":"https://api.github.com/users/swankjesse/repos","events_url":"https://api.github.com/users/swankjesse/events{/privacy}","received_events_url":"https://api.github.com/users/swankjesse/received_events","type":"User","site_admin":false},"created_at":"2016-06-25T19:05:39Z","updated_at":"2016-06-25T19:05:39Z","body":"Awww, that’s awkward. We’ve seen other problems with Robolectric, mostly around how OkHttp attempts to detect which platform it’s running on. Robolectric makes that very difficult because it looks like Android and the JVM simultaneously."}}
{"actor":{"display_login":"swankjesse"}}