title: Apache HttpClient and custom ports
body: <p>I'm using the Apache HttpClient 4 and it works fine. The only thing that doesn't work is custom ports. It seems like the root directory is fetched and the port is ignored.</p>
  
  <pre><code>HttpPost post = new HttpPost("http://myserver.com:50000");
  HttpResponse response = httpClient.execute(post);
  </code></pre>
  
  <p>If no port is defined, http- and https-connections work well.
  The scheme registry is defined as follows:</p>
  
  <pre><code>final SchemeRegistry sr = new SchemeRegistry();
  
  final Scheme http = new Scheme("http", 80,
        PlainSocketFactory.getSocketFactory());
  sr.register(http);
  
  final SSLContext sc = SSLContext.getInstance(SSLSocketFactory.TLS);
    sc.init(null, TRUST_MANAGER, new SecureRandom());
  SSLContext.setDefault(sc);
  
  final SSLSocketFactory sf = new SSLSocketFactory(sc,
        SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
  
  final Scheme https = new Scheme("https", 443, sf);
    sr.register(https);
  </code></pre>
  
  <p>How can I define custom ports for a request?</p>