private Response<T> handleResponse(final String response) {
    if (response.contains("Bad API request")) {
      return Responses.failed(response);
    }

    @SuppressWarnings("unchecked")
    final Response<T> successResponse = (Response<T>) Responses.success(response);
    return successResponse;
  }
  public Response<T> executeAsGet() {
    HttpURLConnection connection = null;

    try {
      connection = openConnection(endpoint + "?" + parameters.toUrlFormat());
      final String response = buildResponse(connection.getInputStream());
      return handleResponse(response);
    } catch (final IOException e) {
      return Responses.failed("Unable to connect to Pastebin endpoint!");
    } finally {
      if (connection != null) {
        connection.disconnect();
      }
    }
  }
  public Response<T> executeAsPost() {
    HttpURLConnection connection = null;

    try {
      connection = openConnection(endpoint);
      connection.setDoOutput(true);
      connection.setRequestMethod("POST");

      sendParameters(connection.getOutputStream(), parameters);

      final String response = buildResponse(connection.getInputStream());
      return handleResponse(response);
    } catch (final IOException e) {
      return Responses.failed("Unable to connect to Pastebin endpoint!");
    } finally {
      if (connection != null) {
        connection.disconnect();
      }
    }
  }