public String send(String gatewayURL, String request)
    {
        URL url;
        HttpsURLConnection connection = null;
        StringBuilder response = null;
        try
        {
            //Create connection
            url = new URL(gatewayURL);
            connection = (HttpsURLConnection) url.openConnection();
            
            connection.setRequestMethod("POST");
            connection.setRequestProperty("Content-Type",
                    "application/x-www-form-urlencoded");
            connection.setRequestProperty("Content-Length", ""
                    + Integer.toString(request.getBytes().length));
            connection.setDoInput(true);
            connection.setDoOutput(true);
            connection.setHostnameVerifier(new HostnameVerifier()  
            {   
                //Should be removed in production system.
                public boolean verify(String hostname, SSLSession session)  
                {  
                    return true;  
                }
            }); 
            //Send request
            DataOutputStream wr = new DataOutputStream(
                    connection.getOutputStream());
            wr.writeBytes(request);
            wr.flush();
            wr.close();

            
            //Get HTTP Response
            if (connection.getResponseCode() == HttpURLConnection.HTTP_OK)
            {  
                InputStream is = connection.getInputStream();
                BufferedReader rd = new BufferedReader(new InputStreamReader(is));
                String line;
                response = new StringBuilder();
                if (outputHTTPHeaders) {
                    response.append(getHeaders(connection));
                }
                while ((line = rd.readLine()) != null)
                {
                    response.append(line);
                    response.append('\r');
                }
                rd.close();
                is.close();
            }
            else
            {
                if (outputHTTPHeaders) {
                    response.append(getHeaders(connection));
                }
                response.append("Received HTTP response code: ");
                response.append(connection.getResponseCode());
                response.append(" - ");
                response.append(Https.httpResponseCode(connection.getResponseCode()));
            }
        }
        catch (IOException e)
        {
            LOGGER.log(Level.SEVERE, e.getMessage());
        }
        finally
        {
            if (connection != null)
            {
                connection.disconnect();
            }
        }
        try
        {
            if (response == null) {
                return null;
            }
            return URLDecoder.decode(response.toString(), "UTF-8");
        }
        catch (UnsupportedEncodingException ex)
        {
            LOGGER.log(Level.SEVERE, null, ex);
            return null;
        }
    }