Configure proxy and dns server for a single URLConnection

Hello!
I am relatively new to network programming in Java so I was looking for a solution to set a DNS server and a PROXY server for one SINGLE UrlConnection. The settings should only be used in one thread, while another thread maybe has different settings.
The most suggestions I found on the net looked like follows:
Proxy:
System.setProperty("proxyPort","8080");
System.setProperty("proxyHost","proxy");
DNS Server
sun.net.spi.nameservice.provider.<n>=<default|dns,sun|...>
sun.net.spi.nameservice.nameservers=<server1_ipaddr,server2_ipaddr ...>
sun.net.spi.nameservice.domain=<domainname>
The problem is that both solutions are not thread safe and the settings are valid system wide (as far as I am understand). In my application a lot of different workerThreads open a connection to a remote server via URLConnection , for example:
URL url = new URL("http://www.sun.com");
HttpURLConnection con = (HttpURLConnection) url.openConnection();In the worst case 200 different workerThreads open a connection nearly at the same time. If the worst case happens one workerThread changes the DNS and PROXY settings and in the next step another thread which already has set dns and proxy tries to connect to a specified server with wrong dns and proxy settings.
One solution would be to synchronize the whole method that configures the connection and tries to connect to a remote server but that would be a very bad solution for me, because all other threads have to wait until the last thread has finished.
My question: Is there a possibility to configure a different DNS server and a different PROXY server for each URLConnection, for example something like:
URL url = new URL("http://www.sun.com");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setProxyHost("proxy");
con.setProxyPort("3128");
con.setProxyUsername("user");
con.setProxyPassword("pass");
con.setDNS("85.27.63.2");Thanks in advance for your answers.
Kind regards,
Buliwyf

Mainly because it's in the spec. I did not figure out exactly why it is necessary to use different dns servers. Let me give you a quick glimpse what the application should do:
The application checks if a URL is still available and returns an xml file with a return code (401 for example), connection time, an extract of thesource code and other information. This event repeats periodically (every 10 s, 20 min...). Therefore the customer has a good overview about the availability of his websites.
The customer himself controls the process with a xml configuration file that is read on the startup of the application. In the xml file you can find information like: connection timeout, http proxy, https proxy, used user agents, prefered request method (post or get) and regretfully even the DNS server that should be used.
Regretfully I don't have a chance to get the dns removed from the spec. The GUI which delivers the xml is already implemented and won't be changed.

Similar Messages

  • Time Capsule as DHCP Router and DNS server for larger network - too taxing?

    Ok, let me say first that I'm no networking expert, but I have tried to learn a decent amount over the years. I haven't got quite gotten o the level of combing router event logs, though I intend to do that as my next step. My question here though is if my overall network strategy is flawed.
    My setup at home is one that may be a bit more extensive than most users have:
    Cable modem -> Time Capsule -> Multiple gigabit switches (business grade) -> Wired Cat5e throughout the house and 2 Airport Extremes. I don't know how many total wired and wireless clients I have, but it may be between 30 and 40 (only a few are computers with the rest being game systems, networked DVRs, audio streamers, NAS, etc)
    At the moment, the Time Capsule only backs up one machine - a MBP (I have external HDDs connected directly to the desktops). I don't use the TC's HDD for anything else. Also, I have the network configured so that the TC handles DHCP addressing and NAT. The Airport Extremes are in bridge mode.
    For the most part, everything works very well. Internet speeds are good, audio streaming works well, no problems with TC backups, etc. The only issue I've run into are dropouts when streaming video content on the network from one device to another (not form the internet). Basically, the stream will pause and then an error will pop up on screen saying that there was a network problem. Now, I know that the specific devices themselves may have issues of their own, but since it's happened on more than one system, I'm wondering if there is a common network culprit- expecting the Time Capsule to handle its duties especially while it is doing a backup.
    Here are a few thoughts I have:
    1 - From a technical standpoint, I don't know if all client to client network traffic goes through the TC. I was thinking that communication could happen between devices on the same switch without having to go up to the TC and then back down, but maybe I'm wrong. If I am wrong, that certainly is a bottleneck right there. I'm not segregating the video streamers to their own subnet on a new router to isolate the traffic. I'm also not sure if the bottleneck is impacted by static vs dynamic IP addressing. IOW, I don't know if setting the devices up with static IPs would change the flow of traffic to not have to go through the TC (just flow across the switch) or not.
    2 - Long ago in a different network setup, I had allowed the wireless access points to assign IPs. However, I found that doing so sometimes created problems accessing some of those devices from a computer or device on a different subnet. As such, I switched over to having the router connected to the modem do all the IP addressing. Maybe this is a bad idea given the temporary nature that some devices will hop on and off the network.
    3 - Additionally, in the interests of getting better wireless coverage over the whole house, I switched to using 2 airport extremes configured to use the same SSID (so that devices moving around the house wouldn't need to specifically change networks in order to get better signal). I guess I could let one of those 2 handle IP addressing while the other is in bridge mode (pointing to the primary Extreme vs the TC).
    4 - Kind of getting back to the TC as the bottleneck, maybe it shouldn't handle network wide DHCP and NAT duties. If TC backups take network priority, such that other kinds of traffic could hiccup, then I probably need to rethink where the TC should exist in the network. Or, maybe it would be enough to just have the stream sensitive components be on their own subnet.
    I know there are potentially multiple flaws in my current strategy, so any suggestions or attempts at correcting my assumptions would be helpful.
    Thanks!
    Jeff
    Message was edited by: Rgbyhkr
    Message was edited by: Rgbyhkr

    Welcome to the discussions!
    1 - Everything goes through the router when it is setup to handle DHCP and NAT
    2 - You want your main router, the TC, to handle all DHCP and NAT functions. It will handle up to 250+ connections, so 30-40 devices won't be much of a challenge
    3 - Keep both AirPort Extremes in bridge mode to allow the TC to handle the things in #2 above. If you setup an Airport Extreme to give out IP addresses, you'll create a Double NAT issue on your network...which can slow down communications between devices...the thing you are trying to avoid. If you use Xbox live or other interactive services, the online features will not function with a Double NAT on your network.
    4 - You want the TC to handle all DHCP and NAT functions as in #2. I assume that you have no single run of CAT5e more than 300 feet.
    5 - If you want to create separate sub nets correctly (the AirPorts won't allow you to do this as they are designed for basic home networking), you'll need to look at routers for professional and commercial use, like Cisco.
    With as many devices as you have, you may be running out of bandwidth at times. If you only notice the issue during Time Machine backups, and you don't need to backup each hour, take a look at Time Machine Editor to setup backups whenever you like, maybe once a day at 2 AM when things on the network are quiet.
    My suggestions are of course opinions. Hopefully you'll receive some other possibly differing views.

  • Proper Configuration of DNS server for our new branch office

    Hi All,
    Our new office will setup a new branch office with a routed network link to our HO. In HO, we have 2 domain controllers configured as AD and DNS just for fail over scenarios.
    How will we configure the DNS server of our 3rd domain controller which we will placed in the new branch office. What would be the proper settings of DNS server integrated to AD to work well especially to have a successful replication and communication to
    the 2 DC's located in HO?

    Hi,
    If you have multiple DC's in that site i would recommend using any of the partner DC's IP addresses as preferred one and secondary DNS IP to pointing to itself. Dont use loopback addresses configure it with actual IP addresses.
    If you have only one server in branch office point itself as the primary DNS and HO DC as secondary and tertiary.
    Make sure that all clients in your branch site are pointing to the branch DC as primary DNS server.
    Regards,
    Rafic
    If you found this post helpful, please give it a "Helpful" vote.
    If it answered your question, remember to mark it as an "Answer".
    This posting is provided "AS IS" with no warranties and confers no rights! Always test ANY suggestion in a test environment before implementing!

  • Problem with proxy and DNS

    Hello,
    in our company we use Internet Explorer 8... (i know...) We also have a proxy and 4 DNS servers. Last weekend we suddenly had an issue where internet pages could not be loaded. When we did some testing with Wireshark we saw that it took a long time to query
    www.google.com or www.microsoft.com. The query went from the first DNS server to the second and so on. This behaviour was shown on Windows 2008 R2 servers with Citrix and also the workstations and laptops with Windows 7.
    When we deleted the DNS servers from the network settings and set the proxy ip-adres in the browser the problem was solved. So the problem had to be in DNS.
    After that we deleted the list of Root Hints and the problem seemed to be solved. However, when we look in wireshark we still see that external addresses are queried againts our local DNS servers. In internet explorer we have a policy active where the proxy
    is set. We have two proxies and the problem exists with both of them.
    So the question is, why does IE8 still query all four DNS servers even when we have a proxy? Why is there a lot of delay there?
    Thanks!

    Hi,
    Generally, if you configure IE with an explicit proxy:
    1.User types an address
    2.The address is checked for string matches against the IE proxy exceptions list
    a. If matching a bypassed entry, DNS is used to resolve the name, and the client connects directly to the target IP address on port 80 (assumed), then sends a request like:
    GET /something.htm HTTP/1.1
    Host: fulldomainame.example.com
    b. If non matching, continue
    3.The client connects to its configured proxy and sends a request of the form:
    GET http://fulldomainname.example.com/something.htm HTTP/1.1
    (this use of the FQDN in the URL is one way you can tell that a client thinks it's talking to a proxy instead of a real web server)
    4.The proxy resolves the name, connects to the target site, etc, etc
    So what’s your configuration of proxy?
    Alex Zhao
    TechNet Community Support

  • How to configure proxy services in OSB for Rest based services?

    how to configure proxy services in OSB for Rest based services implemented using Jersey (Rest).
    The Client need to contact OSB proxy servies by posting application/xml using jersey client and OSB proxy service will call the OSB business service.
    i would like to know how to get this request in OSB proxy service and send it to the business service and get the response back.

    I would suggest you refer to the below links:
    https://blogs.oracle.com/jeffdavies/entry/restful_services_with_oracle_s_1
    https://blogs.oracle.com/jamesbayer/entry/using_rest_with_oracle_service
    Hope this helps.
    Thanks,
    Patrick

  • GSS as primary DNS Server for Intranet

    Hi,
    Can the GSS be used as a as primary DNS server for Intranet? An additional DNS server can be configured to answer the unknown Records like MX by GSS.
    if it can be configured, I would be thankful if anyone shares with me the brief configuration steps Apart from configuring Answers, answer groups, domain lists, source address lists, DNS rules.
    with thanks
    sathappan

    Yeah I'd certainly recommend against it! So essentially the client machines are unable to update or query dynamic AD related DNS records since they're not pointing to the DNS servers actually used by your AD server(s). I could well imagine that causing
    issues, and meaning that some AD functionality won't work correctly.
    I know you can directly integrate BIND with AD, eg so that the BIND servers are the ones used by AD, though I haven't tried it, but this seems to be neither.
    I can't find any articles relating to your exact situation, presumably no one else has tried to use such a mixed and disjoined setup. I'd focus on looking for articles relating to why you shouldn't point your users at a router (most commonly in small setups
    on ADSL) for the DNS rather than directing them to the server for DNS and then having that query the router for external results. It's a more common scenario and you're more likely to find articles relating to it.
    One article you might find useful is
    http://msmvps.com/blogs/acefekay/archive/2009/08/17/ad-and-its-reliance-on-dns.aspx which talks in terms of using your ISP's DNS servers on the client machines, but in your situation it sounds like the BIND servers are essentially providing an equivalent
    setup.
    There's also various discussions and comments on the topic elsewhere on these forums, for instance
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/c3ba3859-765e-4b3f-add0-eaf2c18e1068/i-have-dns-in-a-router-and-i-want-to-install-domain-controller?forum=winservergen and
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/b5df8fd4-7ab2-4d1e-afe2-c5263c4d69c3/dns-server-forwarding-and-clients-getting-address-of-registrars-ip?forum=winserverNIS which are worth checking out.

  • Dns server for specific domain

    Is there a way to define a dns server for a specific domain?
    I'm setting up a develop machine with an amp stack and i want to redirect all urls with a specific domain (i.e. project.dev) to 127.0.0.1.
    I've done this on OSX with dnsmasq configured in this way:
    # dnsmasq.conf
    address=/.dev/127.0.0.1
    listen-address=127.0.0.1
    port=35353
    and adding a dev file in /etc/resolver with this content
    # /etc/resolver/dev
    nameserver 127.0.0.1
    port 35353
    but this in arclinux with dhcpd doesn't work.
    I've tested dnsmasq with
    dig [email protected] -p 35353
    and it works (the address returned is 127.0.0.1) so the problem is the resolver.
    I've also tried either put into /etc/resov.conf.head this:
    # /etc/resolv.conf.head
    nameserver 127.0.0.1
    port 35353
    and configure dnsmasq with the default 53 port without luck.
    This is my /etc/resolv.conf
    # /etc/resolv.conf
    nameserver 127.0.0.1
    nameserver 192.168.0.1

    On linux you should simply run all dns request through one nameserver that forwards everything it doesn't understand. [Edit: You can do that with dnsmasq.] Another simple way to create a local developer zone would be to use wildcard_dns_proxy instead.
    Last edited by progandy (2015-03-03 17:20:29)

  • Windows server 2012 as primary DC and DNS server and windows server 2003 as secondary DC and DNS

    Migration from windows server 2003 AD DC and DNS server to windows server 2012 R2,
    Cannot I set up Windows server 2012 R2 as primary DC and DNS  , windows server 2003 as secondary DC and DNS ? (for backup server when server 2012 fail, user can continue to login and access internet services)

    You can mix both as long as your Forest and Domain Functional level are Windows Server 2003. However, I would like to bring your attention to this blog about known problems when mixing DCs with Windows Server 2003 and 2012 R2 OS:
    http://blogs.technet.com/b/askds/archive/2014/07/23/it-turns-out-that-weird-things-can-happen-when-you-mix-windows-server-2003-and-windows-server-2012-r2-domain-controllers.aspx
    This posting is provided AS IS with no warranties or guarantees , and confers no rights.
    Ahmed MALEK
    My Website Link
    My Linkedin Profile
    My MVP Profile

  • How can we get the prompt to enter IP Address, Subnet Mask , gateway and DNS Server during Task Sequence?

    How can we get the prompt to enter IP Address, Subnet Mask , gateway and DNS Server during Task Sequence?

    This is for 2007 but may still be relevant for 2012
    http://hexdump.net/?p=391
    Cheers
    Paul | sccmentor.wordpress.com

  • Allocating a (local/in-house) IP address and DNS entry for a cabled Ethernet printer

    I have an MI424WR Fios modem/wireless router.  I have a laser printer connected to it using standard CAT-5 cabling.
    I have tried several times to create a persistent enough IP address so that I can configure a Windows (Windows 7 and Windows 8) printer and printer port and get it to work over time.  On ever other router I've had, I was able to configure a static IP address and configure a local DNS entry for it (which meant I could just configure printer ports looking for http://colorlaser - very easy to remember)
    I think I have it working, then I leave it for a few days and the IP address evaporates and the driver stops working.  The MI424WR advanced menus are nearly indecipherable (compared to *every* other home router I've ever used) and I'm running out of curse words to use when trying to get this to work.
    Any ideas?
    Thanks
    Flydog
    (PS: I'm very impressed that your "Spell Check" refuses to recognize "Fios")

    I've solved this exact issue by configuring a static DHCP lease in the router for the printer.  This way, I don't have to change any settings in the printer; which can be difficult depending on how the printer is configured.
    Yes, I agree that the Actiontec router has a rather unfriendly interface.  However, it is quite powerful once you figure out where everything is hidden.
    Here's the process to setup a static DHCP lease for a printer (or any other device):
    Make sure your printer is on and assigned an IP address.
    Login to router
    Click "My Network" in the top banner menu.
    Click "Network Connections" in the left hand menu.
    Click "Network (home/office)" in the Network Connections box.
    Click "IP Address Distribution" in the Network (home/office) Properties box.  Note it is hard to notice this is a link - click on the words.
    Click on the "Connection List" button at the bottom of the IP Address Distribution Box.
    Locate your printer in the list.  The host-name may be something assigned by the router.
    Click on the edit button in the Action column for the printer.  The edit button is the center icon with a pencil on it.
    Click the "Static Lease Type" checkbox.
    Click Apply.
    Click the edit button for the printer's DHCP entry AGAIN.
    Now, you can set the IP address to any value within the router's DHCP range.  You may also want to change the host name to something that make sense to you.
    You can also try the "New Static Connection" at the bottom of the DHCP connection window, however I've not had much luck with it.
    Good Luck!
    If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer as Accepted Solution so others can see the solution to the problem.

  • What is the best DNS server for iCloud and Apple services?

    Hello. Im wondering what is the best DNS server to use with iCloud, and apple services.
    Does apple have a dedicatrd DNS server?
    I read a couple of articles stating that the google DNS servers like 8.8.8.8 and 8.8.4.4 slow down apple and facebook services.
    Did a couple of tests like iTunes streaming and found out that its true in some cases.

    Not always!
    Found what i was shearching for:
    http://www.who.is/dns/icloud.com/

  • Moving from Exchange 2007 to 2013 (leaving the DNS Server for it's own dedicated server)

    Hello! I am quite new to Exchange and Server management in general. I will do my best to explain my situation.
    I am looking to move my Exchange server off of our DNS server. When we installed them on the same server, we did not have the funds to buy 2 separate servers. I am told that it is best to separate the two. I have followed the Microsoft instructions for installing
    the prerequisites for Exchange 2013 on a 2012 R2 server, and i am at the point where it wants me to configure AD LDS. As I have active directory running on the current server, I was a little hesitant to just install it without understanding what i am doing.
    After the AD LDS is configured, I believe i can move forward with installing Exchange 2013 (all 3 roles will be hosted on the new server), export the mailboxes from 2007 server and import them into the new Exchange 2013 server. After 2013 is up and stable,
    I plan on removing 2007 from the old server (DNS server).
    What are my next steps after importing the mailboxes? Am i missing important details that I need to change or migrate?
    My biggest fear is that nothing works after the installation and moving the mailboxes over. For that case, it makes sense to keep 2007 installed as a fallback for when my installation fails and all i have lost is just my time :)
    Current Server:
    Windows Server 2008 Standard (64 bit)
    1. Roles: Active Directory, DNS, IIS
    2. Software: Exchange 2007
    New Server:
    Windows 2012 R2 Server
    1. Roles: ???
    1. Software to install: Exchange 2013
    Thank you for any help you can provide!

    These are good resources, but i am still caught up with the active directory issue.  Am I able to keep the old Domain/DNS/Active directory on it's current server and move Exchange 2007 off onto a new server (with Exchange 2013)?
    In the first example, he is moving everything (domain controller, exchange, users, etc) onto a different server and decommissioning it.I've been told that it would be better practice to keep the domain and exchange on 2 different servers. Is this true?
    I go to run commands like:
    .\setup /PrepareAD /OrganizationName: orgname /IAcceptExchangeServerLicenseTerms
    on the new exchange server, as a prerequisite and it doesnt recognize the command - even after following the steps before. Is this because the new server is not a domain controller? does it have to be? What are the best practices for setting up a server(s)
    with exchange + domain controller?
    Thanks for responding.

  • How many DNS record need to create in Internal & external DNS server for exchange?

    Hi friends,
    I recently installed Exchange Server 2010 in my organization for testing purpose and I've register a pubic ip too for exchange server on godaddy.com. How many
    internal & External DNS records reqired to configure on external & Internal dns server so my all feature like Auto-discover, Activ -sync,& webmail start working perfectly.
    It's my first time configuring exchange for a organization.
    Thanks & Regards,
    Pradeep Chaugule

    Hi,
    Just as what ManU Philip said, you need to create
    Autodiscovery.domaincom and mail.domain.com for external dns server.
    Generally, you configure your Exchange Servers as DNS clients of your internal DNS server.
    Refer from:
    http://technet.microsoft.com/en-us/library/aa996996(v=exchg.65).aspx
    Best Regards.

  • Externally Hosted DNS - How do I set up my 2003 DNS server for sub domain to point to internal IP address??

    I have a domain name(domain.com) DNS hosted at my ISP. I also have 3 sub domains DNS hosted at the same ISP pointing to various external ip addresses (mail.domain.com, vpn.domain.com and ts.domain.com). We want to set up sales.domain.com to point to an
    internal 10. IP address. We have AD integrated DNS servers for our 2003 AD domain. The AD domain name is totally different than the hosted domain name in question. I currently edit the host file for a couple of PC's but this isnt practical company wide so
    I want to add entries on our internal AD DNS servers to resolve the locally hosted site. If i recall, someone once told me that you cannot just put an A record for one sub domain, I would have to have entries on my 2003 DNS server to resolve anything related
    to the domain.com name. Is this accurate? If so, what is the proper way to configure my 2003 AD DNS server to resolve anything domain.com related for my internal users while still allowing my ISP to do the DNS lookup for the internet.

    On my 2003 AD integrated DNS server...i rightclick forward lookup zone and choose...new zone..primary zone (store zone in AD checkbox checked)..i chose to all DNS servers in the AD domain for replication...zone name sales.domain.com....allow secure updates
    option....then i added an A record in that zone...sales.domain.com..pointed that towards my internal 10. IP address...is this correct? It seems to be working correctly for the sales.domain.com DNS record...and i tested the other sub domains...and those look
    like they are going to my ISP for DNS resolution...
    Is this the correct procedure? I did this on a test AD domain and not my production...i want to make sure i dont break everything under the domain.com by incorrectly adding 1 sub domain..

  • How to use DNS server for name resolution for items which don't exist in active directory domain controller DNS

    Dear Experts,
    In our office we have a domain controller call it 'Office.com', all computers and corporate servers e.g. exchange, antivirus etc. are member of this 'office.com', it is also having a DNS. All users in office have there preferred DNS set to the corporate
    DNS
    We are working for ministry and offering services to them from our data center so have many servers which are for ministry but they are in our data center. For all these servers we created another DNS server which contains all entries for these servers in
    forward and reverse lookup zones. In this DNS we also created a forward lookup zone for our corporate servers and zone name is 'office.com'
    What we are trying to have is name resolution of all servers which are listed in other DNS build in our office on Win 2008 R2 for ministry servers
    If the user change his preferred DNS to ministry DNS he can resolve the ministry server but then we can not control any thing through group policy since they are using other DNS and not the corporate DNS. 
    How this can be done ? like any group policy applied to corporate domain controller must take effect on users and in addition to this user must also be able to resolve server names in ministry project DNS
    Please assist ASAP.
    regards,

    Hello,
    ok so the GPO setting doesn't apply in any case.
    Clients machines use the first DNS server in the list of configured ones on the NIC. If that one is available search for additional DNS servers will stop.
    What i can not really understand is your description about the second DNS server. This should normally either another DC with AD integrated DNS, so everything is replicatedwithin AD replication or you use a secondary DNS on domain member server that pulls
    the informations from the Master.
    It sounds for me that you have configured a machine with DNS server role and created manually the zone with the same name as the domainand manually create there the required A records?
    Best regards
    Meinolf Weber
    MVP, MCP, MCTS
    Microsoft MVP - Directory Services
    My Blog: http://msmvps.com/blogs/mweber/
    Disclaimer: This posting is provided AS IS with no warranties or guarantees and confers no rights.

Maybe you are looking for

  • Data Federator not fetching data USING Netweaver BI Connector

    Hi Gurus, We have upgraded the BW system to use the Data federator. callback ID that SAP NetWeaver BI uses to contact Data Federator has been configured as mentioned in guide. we have already configured the CONNECTOR and we are able to test the conne

  • How can I access WEB-INF/lib

    Hello all, I deployed JClient application using Java Web Start. I have the following lines in jnlp file <resource> <jar href="WEB-INF/lib/share.jar" /> </resource> There's actually share.jar under WEB-INF/lib directory, but I got error message when e

  • Solaris 10 sconadm registration fails - InvalidAssetException

    Hello, I'm having the same problem that many others seem to be having with registering a system for the first time. Sparc system running solaris 10 I have tried the following procedures to no avail. I can log into updates.sun.com with my username and

  • Adding objects to an image?

    I am new to PE3 and I would like to be able to add items like balls, snowflakes, stars, sun, moon ect.. Are such objects in PE3 or are they available from another source? In searching files I have seen such objects that appear to be in PE3 but have n

  • SO7 installation problem patch 5

    Hello, I try to apply the patch so-7-pp5-bin-linux.bin on a serverinstallation, but the installation fail. (OS : suse 9.2 glibc 2.3.3) I do: ./so-7-pp5-bin-linux.bin -patch [path to network installation] --> I see a message in a window for a very sho