Code example for UsernamePasswordCredentials

0
httpClient = new DefaultHttpClient();
             
            if( getUsername() != null || getPassword() != null ) 
            { 
                httpClient.getCredentialsProvider().setCredentials(
                    new AuthScope( getHost(), getHttpPort() ),
                    new UsernamePasswordCredentials( getUsername(), getPassword() ) );
            } 
        } 
         
        return httpClient;
    } 
 
    public int getHttpPort() 
    { 
        return httpPort;
    } 
 
    protected String getHttpResponse( HttpUriRequest request ) throws Exception
    {