private static HttpHost determineTarget ( HttpUriRequest request ) throws ClientProtocolException { // A null target may be acceptable if there is a default target. // Otherwise, the null target is detected in the director. HttpHost target = null ; URI requestURI = request . getURI ( ) ; if ( requestURI . isAbsolute ( ) ) { target = URIUtils . extractHost ( requestURI ) ; if ( target == null ) { throw new ClientProtocolException ( "URI does not specify a valid host name: " + requestURI ) ; } } return target ; }
copied from httpclient source code