Search in sources :

Example 1 with HttpPostHC4

use of org.apache.http.client.methods.HttpPostHC4 in project Signal-Android by WhisperSystems.

the class OutgoingLegacyMmsConnection method constructRequest.

private HttpUriRequest constructRequest(byte[] pduBytes, boolean useProxy) throws IOException {
    try {
        HttpPostHC4 request = new HttpPostHC4(apn.getMmsc());
        for (Header header : getBaseHeaders()) {
            request.addHeader(header);
        }
        request.setEntity(new ByteArrayEntityHC4(pduBytes));
        if (useProxy) {
            HttpHost proxy = new HttpHost(apn.getProxy(), apn.getPort());
            request.setConfig(RequestConfig.custom().setProxy(proxy).build());
        }
        return request;
    } catch (IllegalArgumentException iae) {
        throw new IOException(iae);
    }
}
Also used : Header(org.apache.http.Header) ByteArrayEntityHC4(org.apache.http.entity.ByteArrayEntityHC4) HttpHost(org.apache.http.HttpHost) HttpPostHC4(org.apache.http.client.methods.HttpPostHC4) IOException(java.io.IOException)

Example 2 with HttpPostHC4

use of org.apache.http.client.methods.HttpPostHC4 in project Signal-Android by signalapp.

the class OutgoingLegacyMmsConnection method constructRequest.

private HttpUriRequest constructRequest(byte[] pduBytes, boolean useProxy) throws IOException {
    try {
        HttpPostHC4 request = new HttpPostHC4(apn.getMmsc());
        for (Header header : getBaseHeaders()) {
            request.addHeader(header);
        }
        request.setEntity(new ByteArrayEntityHC4(pduBytes));
        if (useProxy) {
            HttpHost proxy = new HttpHost(apn.getProxy(), apn.getPort());
            request.setConfig(RequestConfig.custom().setProxy(proxy).build());
        }
        return request;
    } catch (IllegalArgumentException iae) {
        throw new IOException(iae);
    }
}
Also used : Header(org.apache.http.Header) ByteArrayEntityHC4(org.apache.http.entity.ByteArrayEntityHC4) HttpHost(org.apache.http.HttpHost) HttpPostHC4(org.apache.http.client.methods.HttpPostHC4) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)2 Header (org.apache.http.Header)2 HttpHost (org.apache.http.HttpHost)2 HttpPostHC4 (org.apache.http.client.methods.HttpPostHC4)2 ByteArrayEntityHC4 (org.apache.http.entity.ByteArrayEntityHC4)2