@Test public void testPost() throws Exception { String requestBody = "req"; String responseBody = "resp"; setResponseExpectations(200, responseBody); HttpURLConnection response = sender.post(Constants.GCM_SEND_ENDPOINT, requestBody); assertEquals(requestBody, new String(outputStream.toByteArray())); verify(mockedConn).setRequestMethod("POST"); verify(mockedConn).setFixedLengthStreamingMode(requestBody.length()); verify(mockedConn).setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"); verify(mockedConn).setRequestProperty("Authorization", "key=" + authKey); assertEquals(200, response.getResponseCode()); }
protected HttpURLConnection post(String url, String body) throws IOException { return post(url, "application/x-www-form-urlencoded;charset=UTF-8", body); }
Sender { protected HttpURLConnection post(String url, String body) throws IOException { return post(url, "application/x-www-form-urlencoded;charset=UTF-8", body); } }
Sender { protected HttpURLConnection post(String url, String body) throws IOException { return post(url, "application/x-www-form-urlencoded;charset=UTF-8", body); } Sender(String key); }
Sender { protected HttpURLConnection post(String url, String body) throws IOException { return post(url, "application/x-www-form-urlencoded;charset=UTF-8", body); } Sender(String key); Result send(Message message, String registrationId, int retries); Result sendNoRetry(Message message, String registrationId); MulticastResult send(Message message, List<String> regIds, int retries); MulticastResult sendNoRetry(Message message,
      List<String> registrationIds); }
Sender { protected HttpURLConnection post(String url, String body) throws IOException { return post(url, "application/x-www-form-urlencoded;charset=UTF-8", body); } Sender(String key); Result send(Message message, String registrationId, int retries); Result sendNoRetry(Message message, String registrationId); MulticastResult send(Message message, List<String> regIds, int retries); MulticastResult sendNoRetry(Message message,
      List<String> registrationIds);  }