provisioning/provisioning-service-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/service/transport/https/HttpRequest.java [51:87]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public HttpResponse send() throws IOException
    {
        int responseStatus;
        byte[] responseBody = new byte[0];
        byte[] errorReason = new byte[0];
        Map<String, List<String>> headerFields;
        try
        {
            // Codes_SRS_HTTPREQUEST_25_005: [The function shall send an HTTPS request as formatted in the constructor.]
            this.connection.connect();

            responseStatus = this.connection.getResponseStatus();
            headerFields = this.connection.getResponseHeaders();
            responseBody = this.connection.readInput();
        }
        // Can be caused either by an unsuccessful
        // connection or by a bad status code.
        catch (IOException e)
        {
            // If the IOException was caused by a bad status code in the
            // response, then getResponseStatus() returns a valid status code.
            // Otherwise, a connection could not be established and
            // getResponseStatus() throws an IOException.
            // Codes_SRS_HTTPREQUEST_25_007: [If the client cannot connect to the server, the function shall throw an IOException.]
            responseStatus = this.connection.getResponseStatus();
            headerFields = this.connection.getResponseHeaders();
            // Codes_SRS_HTTPREQUEST_25_008: [If an I/O exception occurs because of a bad response status code, the function shall attempt to flush or read the error stream so that the underlying HTTPS connection can be reused.]
            // Connections are transparently managed by Java.
            // The error stream must be cleared so that the connection
            // can be reused later.
            errorReason = this.connection.readError();
        }

        // Codes_SRS_HTTPREQUEST_25_006: [The function shall return the HTTPS response received, including the status code, body, header fields, and error reason (if any).]
        return new HttpResponse(responseStatus, responseBody, headerFields,
                errorReason);
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/transport/https/HttpRequest.java [46:78]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public HttpResponse send() throws IOException
    {
        int responseStatus;
        byte[] responseBody = new byte[0];
        byte[] errorReason = new byte[0];
        Map<String, List<String>> headerFields;
        try
        {
            this.connection.connect();

            responseStatus = this.connection.getResponseStatus();
            headerFields = this.connection.getResponseHeaders();
            responseBody = this.connection.readInput();
        }
        // Can be caused either by an unsuccessful
        // connection or by a bad status code.
        catch (IOException e)
        {
            // If the IOException was caused by a bad status code in the
            // response, then getResponseStatus() returns a valid status code.
            // Otherwise, a connection could not be established and
            // getResponseStatus() throws an IOException.
            responseStatus = this.connection.getResponseStatus();
            headerFields = this.connection.getResponseHeaders();
            // Connections are transparently managed by Java.
            // The error stream must be cleared so that the connection
            // can be reused later.
            errorReason = this.connection.readError();
        }

        return new HttpResponse(responseStatus, responseBody, headerFields,
                errorReason);
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



