Android ProtocolVersion - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ProtocolVersion class.

This code example shows how to use the following methods:
    protected Context getContext() {
        return getInstrumentation().getContext();
    } 
 
    public PersitingActorTestCase<T> given(InputStream in) {
        httpResponse = new BasicHttpResponse(new BasicStatusLine(new ProtocolVersion("http", 1, 1),
                200, "OK")); 
        InputStreamEntity entity = new InputStreamEntity(in, -1);
        httpResponse.setEntity(entity);
        return this;
    } 
 
    public PersitingActorTestCase<T> given(String httpResponseBody) {
        httpResponse = new BasicHttpResponse(new BasicStatusLine(new ProtocolVersion("http", 1, 1),
                200, "OK")); 
        StringEntity entity = null;
        try { 
            entity = new StringEntity(httpResponseBody);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
6
CodeRank
This code example shows how to use the following methods:
                return getUri().toString();
            } 
             
            @Override 
            public ProtocolVersion getProtocolVersion() {
                return new ProtocolVersion("HTTP", 1, 1);
            } 
             
            @Override 
            public String getMethod() {
                return mMethod;
            } 
             
            @Override 
            public String toString() {
                String path = AsyncHttpRequest.this.getUri().getPath();
                if (path.length() == 0)
                    path = "/";
                String query = AsyncHttpRequest.this.getUri().getRawQuery();
                if (query != null && query.length() != 0) {
6
CodeRank
This code example shows how to use the following methods:
    // This is the only one we actually use. 
    @Override 
    public HttpResponse execute(HttpUriRequest request, HttpContext context) {
        requestExecuted = request;
        StatusLine statusLine = new BasicStatusLine(
                new ProtocolVersion("HTTP", 1, 1), mStatusCode, "");
        HttpResponse response = new BasicHttpResponse(statusLine);
        response.setEntity(mResponseEntity);
 
        return response;
    } 
 
 
    // Unimplemented methods ahoy 
 
    @Override 
    public HttpResponse execute(HttpUriRequest request) {
        throw new UnsupportedOperationException();
    } 
 
5
CodeRank
This code example shows how to use the following methods:
import org.junit.Before; 
import org.junit.Test; 
 
public class TestCacheInvalidator { 
 
    private static final ProtocolVersion HTTP_1_1 = new ProtocolVersion("HTTP", 1, 1);
 
    private CacheInvalidator impl;
    private HttpCacheStorage mockStorage;
    private HttpHost host;
    private CacheKeyGenerator cacheKeyGenerator;
    private HttpCacheEntry mockEntry;
    private HttpRequest request;
    private HttpResponse response;
 
    private Date now;
    private Date tenSecondsAgo;
 
    @Before 
    public void setUp() { 
3
CodeRank
This code example shows how to use the following methods:
import org.junit.Before; 
import org.junit.Test; 
 
public class TestResponseCachingPolicy { 
 
    private static final ProtocolVersion HTTP_1_1 = new ProtocolVersion("HTTP", 1, 1);
    private ResponseCachingPolicy policy;
    private HttpResponse response;
    private HttpRequest request;
    private int[] acceptableCodes = new int[] { HttpStatus.SC_OK,
            HttpStatus.SC_NON_AUTHORITATIVE_INFORMATION, HttpStatus.SC_MULTIPLE_CHOICES,
            HttpStatus.SC_MOVED_PERMANENTLY, HttpStatus.SC_GONE };
    private Date now;
    private Date tenSecondsFromNow;
    private Date sixSecondsAgo;
 
    @Before 
    public void setUp() throws Exception { 
        now = new Date();
        sixSecondsAgo = new Date(now.getTime() - 6 * 1000L);
3
CodeRank
This code example shows how to use the following methods:
 */ 
public class AgatteParserTest extends AndroidTestCase {
 
    public void testParseResponse() throws Exception { 
        AgatteParser instance  = AgatteParser.getInstance();
        HttpResponse test = new BasicHttpResponse(new ProtocolVersion("HTTP", 1, 1), 20, "OK");
        BasicHttpEntity test_entity = new BasicHttpEntity();
        test_entity.setContent(new ByteArrayInputStream(response_test1.getBytes()));
        test.setEntity(test_entity);
 
        Iterator<String> actual = instance.parse_query_response(test).iterator();
        assertTrue(actual.hasNext());
        assertEquals("12:10", actual.next());
        assertTrue(actual.hasNext());
        assertEquals("13:00", actual.next());
        assertFalse(actual.hasNext());
 
    } 
 
    public void testParseResponse2() throws Exception { 
3
CodeRank
This code example shows how to use the following methods:
import org.junit.Ignore; 
import org.junit.Test; 
 
public class DoNotTestProtocolRequirements { 
 
    private static final ProtocolVersion HTTP_1_1 = new ProtocolVersion("HTTP", 1, 1);
 
    private static final int MAX_BYTES = 1024;
    private static final int MAX_ENTRIES = 100;
 
    private HttpHost host;
    private HttpEntity mockEntity;
    private HttpClient mockBackend;
    private HttpCache mockCache;
    private HttpRequest request;
    private HttpResponse originResponse;
 
    private CachingHttpClient impl;
 
    @Before 
4
CodeRank
This code example shows how to use the following methods:
 * and are expected to be a drop-in replacement. The test cases captured here 
 * document the places where we differ from the HTTP RFC. 
 */ 
public class TestProtocolDeviations { 
 
    private static ProtocolVersion HTTP_1_1 = new ProtocolVersion("HTTP", 1, 1);
 
    private static final int MAX_BYTES = 1024;
    private static final int MAX_ENTRIES = 100;
    private int entityLength = 128;
 
    private HttpHost host;
    private HttpEntity body;
    private HttpEntity mockEntity;
    private HttpClient mockBackend;
    private HttpCache mockCache;
    private HttpRequest request;
    private HttpResponse originResponse;
 
    private CachingHttpClient impl;
3
CodeRank
This code example shows how to use the following methods:
public class DummyHttpClient implements HttpClient {
 
    private HttpParams params = new BasicHttpParams();
    private ClientConnectionManager connManager = new SingleClientConnManager();
    private HttpRequest request;
    private HttpResponse response = new BasicHttpResponse(new ProtocolVersion("HTTP",1,1), HttpStatus.SC_OK, "OK");
    private int executions = 0;
     
    public void setParams(HttpParams params) {
        this.params = params;
    } 
     
    public HttpParams getParams() {
        return params;
    } 
 
    public ClientConnectionManager getConnectionManager() {
        return connManager;
    } 
     
4
CodeRank
This code example shows how to use the following methods:
public class DummyHttpClient implements HttpClient {
 
    private HttpParams params = new BasicHttpParams();
    private ClientConnectionManager connManager = new SingleClientConnManager();
    private HttpRequest request;
    private HttpResponse response = new BasicHttpResponse(new ProtocolVersion("HTTP",1,1), HttpStatus.SC_OK, "OK");
     
    public void setParams(HttpParams params) {
        this.params = params;
    } 
     
    public HttpParams getParams() {
        return params;
    } 
 
    public ClientConnectionManager getConnectionManager() {
        return connManager;
    } 
     
    public void setConnectionManager(ClientConnectionManager ccm) {
4
CodeRank

Related Android ProtocolVersion Questions & Answers:

See Code Examples for Android ProtocolVersion Methods: