server.setHandler( handler );
server.start();
int port = server.getConnectors()[0].getLocalPort();
NetworkProxyConfiguration proxyConfig = new NetworkProxyConfiguration();
proxyConfig.setHost( "localhost" );
proxyConfig.setPort( port );
proxyConfig.setProtocol( "http" );
proxyConfig.setId( PROXY_ID );
config.getConfiguration().addNetworkProxy( proxyConfig );
// Setup target (proxied to) repository.
RemoteRepositoryConfiguration repoConfig = new RemoteRepositoryConfiguration();