Android ProtocolException - 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 ProtocolException class.

This code example shows how to use the following methods: getMessage
			try { 
				String fixed = fix(location);
				logger.warn("The url that redirected is not valid, fix {} -> {}", location, fixed);
				return new URI(fixed);
			} catch (Throwable e) {
				logger.error(ex.getMessage(), ex);
				return null; 
			} 
		} 
	} 
} 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
        final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK");
        Mockito.when(responseFactory.newHttpResponse(HttpVersion.HTTP_1_1, 200, context)).thenReturn(response);
        final HttpResponse error = new BasicHttpResponse(HttpVersion.HTTP_1_0, 500, "Oppsie");
        Mockito.when(responseFactory.newHttpResponse(HttpVersion.HTTP_1_0, 500, context)).thenReturn(error);
        Mockito.when(handlerResolver.lookup(request)).thenReturn(requestHandler);
        Mockito.doThrow(new ProtocolException("oh, this world is wrong")).when(
                requestHandler).handle(request, response, context);
        Mockito.when(connReuseStrategy.keepAlive(error, context)).thenReturn(Boolean.FALSE);
 
        httpservice.handleRequest(conn, context);
 
        Assert.assertSame(conn, context.getConnection());
        Assert.assertSame(request, context.getRequest());
        Assert.assertSame(error, context.getResponse());
 
        Assert.assertEquals(HttpStatus.SC_BAD_REQUEST, error.getStatusLine().getStatusCode());
 
        Mockito.verify(conn).sendResponseHeader(error);
        Mockito.verify(httprocessor).process(error, context);
        Mockito.verify(conn).sendResponseHeader(error);
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
		if(request==null){
			throw new IllegalArgumentException("HTTP request may not be null");
		} 
		if(request instanceof HttpEntityEnclosingRequest){
			if(request.containsHeader(SOAP_Action)){
				throw new ProtocolException("SOAPAction header already present");				
			} 
			if(request.getParams().getParameter(SOAP_Action)!=null){
				request.addHeader(SOAP_Action,(String) request.getParams().getParameter(SOAP_Action));
			} 
		} 
	} 
 
} 
Full Snippet Info
4
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
                identifier);
      
        // response not used 
        EasyMock.expect( 
                mockClient.revalidateCacheEntry(target, request, mockContext,
                        mockCacheEntry)).andThrow(new ProtocolException());
        mockParent.markComplete(identifier);
         
        replayMocks(); 
        impl.run();
        verifyMocks(); 
    } 
     
    @Test 
    public void testRunGracefullyHandlesIOException() throws IOException, ProtocolException { 
        String identifier = "foo";
         
        AsynchronousValidationRequest impl = new AsynchronousValidationRequest(
                mockParent, mockClient, target, request, mockContext, mockCacheEntry,
                identifier);
Full Snippet Info
4
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
    } 
 
    public long determineLength(final HttpMessage message) throws HttpException {
        final long result = this.contentLengthStrategy.determineLength(message);
        if (result == ContentLengthStrategy.IDENTITY) {
            throw new ProtocolException("Identity transfer encoding cannot be used");
        } 
        return result;
    } 
 
} 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
See Code Examples for Android ProtocolException Methods: