Assert.assertEquals(123, address.getPort());
}
@Test
public void testResolveRemoteAddressViaProxy() throws Exception {
final InternalAddressResolver addressResolver = new InternalAddressResolver(
schemePortResolver, dnsResolver);
final HttpHost target = new HttpHost("somehost");
final HttpHost proxy = new HttpHost("someproxy");
final HttpRoute route = new HttpRoute(target, null, proxy, false);
Mockito.when(schemePortResolver.resolve(proxy)).thenReturn(8888);
final byte[] ip = new byte[] {10, 0, 0, 10};
Mockito.when(dnsResolver.resolve("someproxy")).thenReturn(new InetAddress[] {InetAddress.getByAddress(ip)});
final InetSocketAddress address = (InetSocketAddress) addressResolver.resolveRemoteAddress(route);
Assert.assertNotNull(address);
Assert.assertEquals(InetAddress.getByAddress(ip), address.getAddress());
Assert.assertEquals(8888, address.getPort());
}