Client-Proxy-Server:  Connection refused

I was meddling with a client-proxy-server toy program.
Pardon my poor code construction. I have never had any previous knowledge in this field.
I have created  a client side program with my main that handles IO serially.
ProxY consists of 2 unscynchronized threads each interacts with client and server respectively.
Packet exchange within ProxY is relayed using a PacketBuffer object.
Server consist of a single threaded service. Below is the code for my main.
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Scanner;
public class TestProxy
     public static void main(String[] args) throws IOException
          final int SERVER_PORT = 19989;
          final int PROXY_PORT = 19988;
          ServerSocket proxyServerSoc = new ServerSocket(PROXY_PORT);
          Socket proxyClientSoc = new Socket("127.0.0.9",SERVER_PORT); //127.0.0.9 is server IP
          Server serv = new Server(SERVER_PORT);                             //Server started
          ProxY prox = new ProxY(proxyClientSoc, proxyServerSoc);            //proxy started
          //Start Client side;
          Socket toProxy = new Socket("127.0.0.1", PROXY_PORT);
          InputStream in = toProxy.getInputStream();
          OutputStream out = toProxy.getOutputStream();
          Scanner keyboard = new Scanner(System.in);
          String input;
          while(true)
               System.out.println("Enter data  : ");
               input = keyboard.nextLine();
               if(input.equals("exit")) break;
               System.out.println("data in BYTE: "+input.getBytes());
               System.out.println("Sending data to server ...");
               out.write(input.getBytes());
               try{
                    Thread.sleep(100);
               catch(InterruptedException e)
                    e.printStackTrace();
               System.out.println("Received from server :" + in.toString());
}Compilation is a success, but there is a runtime error...
When i attempt to run the program for the first time(tried on XP, Vista, 7, jdk1.6), windows prompts for network permission.
Before i can [edit]unblock[edit] it, my console window shows following error
C:\java\proxy>javac *.java
C:\java\proxy>java TestProxy
Exception in thread "main" java.net.ConnectException: Connection refused: connec
t
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(Unknown Source)
        at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at TestProxy.main(TestProxy.java:15)
C:\java\proxy>Can someone advise me where might i be possibly wrong?
Edited by: J-Ideas on Mar 10, 2010 10:50 PM

               out.write(input.getBytes());
               try{
                    Thread.sleep(100);
               catch(InterruptedException e)
                    e.printStackTrace();
               }What's that for?
               System.out.println("Received from server :" + in.toString());No no no. 'in' is an input stream. in.toString() is just a string representation of that object. It certainly isn't anything received from the server. If you want to receive data from the server you must call one of the in.read() methods.
When i attempt to run the program for the first time(tried on XP, Vista, 7, jdk1.6), windows prompts for network permission.
Before i can [edit]unblock[edit] it, my console window shows following errorYou should separate your program into three: server, proxy, and client, each with their own main() methods, so you can deal with these problems one at a time.

Similar Messages

  • Keep gettig this error message when trying to connect to Firefox The proxy server is refusing connections.

    Redownloaded Firefox and continue to get this error message when trying to connect: The proxy server is refusing connections
    Firefox is configured to use a proxy server that is refusing connections.
    Check the proxy settings to make sure that they are correct.
    Contact your network administrator to make sure the proxy server is
    working.

    Go to Options > Advanced > Network > Connection > Settings and choose "No proxy".
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''
    Not related to your question, but...
    It is important that you keep IE updated. The information included with your question, indicates that you are using IE7; you should update to IE8 for your own protection. IE9 will not be made available for Windows XP.
    *http://windows.microsoft.com/en-US/internet-explorer/products/ie/home

  • I get this error 'The proxy server is refusing connections' i use autoproxy and use linux

    hi I use autoproxy for cross over proxy in my country and i get this error all the time :
    The proxy server is refusing connections
    Firefox is configured to use a proxy server that is refusing connections.
    Check the proxy settings to make sure that they are correct.
    Contact your network administrator to make sure the proxy server is
    working.
    what can I do?

    hello dave, please check in the firefox ''menu ≡ > options > advanced > network > connection - settings...'' that firefox is set up to directly connect to the internet ('no proxy').
    [[Firefox can't load websites but other browsers can]]
    in addition since there is the malicious "general crawler" extension present in your list of addons, please perform a scan of your system with those two free security tools specialised in removing adware and browser hijackers:
    * [http://www.malwarebytes.org/antimalware/ Malwarebytes Anti-Malware Free]
    * [http://www.bleepingcomputer.com/download/adwcleaner/ Adwcleaner]
    [[Troubleshoot Firefox issues caused by malware]]

  • Updated to firefox 3.6.6 on laptop and now it can't acces the net "The proxy server is refusing connections" I've restarted twice. My other computer in home works fine. Just not laptop on Network/WiFi

    Can't access the web on lap. It's networked form main computer. The problem started just after I downloaded/updated to Firefox 3.6.6. That may be a coincidence. I get "The proxy server is refusing connections". Restarts don't help. My main computer is fine. I didn't update it.
    == This happened ==
    Just once or twice
    == just after an update to 3.6.6

    Firefox 3.6.6 made a change in prefs to use system proxy settings.
    Check your proxy / network setting in Windows and change it to No Proxy, if you don't use a proxy.
    Internet Options > Connections in the Windows Control Panel.

  • I am not able to access gmail. Error reading -The proxy server is refusing connections. Please help

    I get the attached error message when trying to access my gmail account "The proxy server is refusing connections. Firefox is configured to use a proxy server that is refusing connections. The problem started today. No issues before.
    Second problem although less of a concern - I am using Firefox 16.0.2.I tried to update to latest version and got the following message " ERROR The requested URL could not be retrieved"
    I can still access my gmail account though my IPAD

    hello, i've tried it with a fresh copy of a catalan firefox & it's showing up as expected for me...
    please try if it's the same when you launch firefox in safemode once (then it might be an issue with an extension hiding this setting) or else try a reset of firefox.
    [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]]
    [[Reset Firefox – easily fix most problems]]

  • I am unable to download firefox 4.0. It says "The proxy server is refusing connections". I don't know what to do!

    I tried to download firefox 4.0 today and now I am unable to connect to the internet from home. It says, "The proxy server is refusing connections." -Firefox is configured to use a proxy server that is refusing connections. -check the proxy settings to make sure they are correct. -contact your network administrator to make sure the proxy is working.
    I do not know what this means or what to do. Please help!

    You can find the connection settings in Tools > Options > Advanced : Network : Connection<br />
    If you do not need to use a proxy to connect to internet then select "No Proxy"
    See "Firefox connection settings":
    * [[Firefox cannot load websites but other programs can]]

  • Whenever I try to go to a website I get the following message: The proxy server is refusing connections. How do I fix this?

    My web proider is Verizon Fios. I've contacted Verizon 4 times about this. I was instructed to delete Firefox and then download again. It didn't help. I'm able to get to your main window. Then, when I try to go to any website, the following window comes up: "The proxy server is refusing connections. Firefox is configured to use a proxy server that is refusing connections. It tells me to "Check the proxy settings to make sure that they are correct." I tried that w/ my Verizon support person but how is one to know what "settings" are "correct"? Finally the window instructs: "Contact your network administrator to make sure the proxy server is working." Who would my "network administrator" be? It wasn't Verizon as they told me they don't support Mozilla.

    You can find the connection settings in Tools > Options > Advanced : Network : Connection
    If you do not need to use a proxy to connect to internet then select "No Proxy"
    See "Firefox connection settings":
    * https://support.mozilla.com/kb/Firefox+cannot+load+websites+but+other+programs+can
    * https://support.mozilla.com/kb/Server+not+found

  • Proxy server is refusing connection. Can not open Firefox to scan for problem

    I keep getting an error message: "Proxy server is refusing connection."
    I can not access Firefox due to this message.
    I went to Firefox site and ran the diagnosis scan with no success to clear symptom.
    Running Windows 7 Home premium
    I have Mcafee virus protection.
    I have not knowingly connected to a proxy server.
    I have two PC's running on a Cisco Systems router and the other PC is not having this symptom.

    If you do not need to use a proxy to connect to internet then select "No Proxy"
    See "Firefox connection settings":
    * [[Firefox cannot load websites but other programs can]]

  • Unable to open any website due to The proxy server is refusing connections, why?

    Firefox is opened, but unable to open any website. The message says, "The proxy server is refusing connections" & "Firefox is configured to use a proxy server that is refusing connections". I installed the version 8.0.1 again. But there was the same message, again!

    Check the connection settings.
    *Tools > Options > Advanced : Network : Connection > Settings
    *https://support.mozilla.com/kb/Options+window+-+Advanced+panel
    If you do not need to use a proxy to connect to internet then select "No Proxy" if the default "Use the system proxy settings" setting doesn't work.
    See "Firefox connection settings":
    *https://support.mozilla.com/kb/Firefox+cannot+load+websites+but+other+programs+can

  • Suddenly get message: Proxy Server is refusing connection. How do I fix to access the Internet as before?

    Had no problems getting on the Internet until about a week ago. Then suddenly when I tried to click on a website, I got this message: "proxy server is refusing connections"; however I have no proxy server when I go into My Computer and check under proxy server. I have tried uninstalling Mozilla Firefox and then downloading the new 4.0--which did, indeed, install.
    Yet, when I clicked on the icon, I got the same old message.
    How can hook back up to the browser so that I can go back online and access internet websites?

    If you do not keep the "No Proxy" setting then see:
    * http://kb.mozillazine.org/Preferences_not_saved

  • Trying to use with TOR - 'Proxy Server is refusing connections' but TOR is connected.

    Added TOR button to Firefox. It could be a TOR problem, but the TOR control panel shows it as connected. When I make TOR enabled and try to go to a website, I get the 'Proxy Server is refusing connections' message.

    In Firefox 3.6.4 and later the default connection settings have been changed to "Use the system proxy settings".<br />
    See "Firefox connection settings" in [[Server not found]]
    You can find the connection settings in "Tools > Options > Advanced : Network : Connection"
    If you do not need to use a proxy to connect to internet then select No Proxy

  • Message "the proxy server is refusing connection" pops up when connecting to wi-fi

    When I go to connect my other dell laptop to the wireless internet, the message (The proxy server is refusing to connect" comes up. it says further, "Firefox is configured to use a proxy server that is refusing connections." Cannot figure out how to (re-configure?) firefox so that I can log onto wi-fi...

    If you do not need to use a proxy to connect to internet then select "No Proxy"
    See "Firefox connection settings":
    * [[Firefox cannot load websites but other programs can]]

  • "Proxy server is refusing connections" error message, fixed with Network Settings but won't save my preferences. Have tried everything!

    I always have to go
    Firefox>Option>Network>Settings>Select Auto-Detect Proxy
    Every time I open firefox.
    I read the "Preferences Not Saved" Help but I don't have a User file in my Containing Folder, so I couldn't change that.
    Deleted my prefs.js files, but when it automatically made a new one it was still stuck on "Manual Proxy Settings" which leads to the "Proxy server is refusing connections" error.
    Any new ideas? Please?

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    *http://kb.mozillazine.org/Preferences_not_saved
    *https://support.mozilla.org/kb/Preferences+are+not+saved

  • Running windows 7 firefox refuses to come up, proxy server is refusing connections network adminiastrater says proxy servers are correct and is issue with firefox what do I do/ do

    I start up firefox and it says the proxy server is refusing connection. It is configured to use a proxy server that is refusing connections. To check the proxy servers and ask network administrater to make sure proxy server is correct They say the proxy server is correct and it is a firefox problem. So what to I do now?

    Make sure that the Firefox connection settings are the same as in IE.
    You can find the connection settings in "Tools > Options > Advanced : Network : Connection"
    If you do not need to use a proxy to connect to internet then select No Proxy
    In Firefox 3.6.4 and later the default connection settings have been changed to "Use the system proxy settings".
    You can compare them with the IE settings in the Internet Options (Control Panel).
    Control Panel > Internet Options > Connections: LAN Settings

  • Everytime I receive an email with an address for the main content, all I get is the following statement "The proxy server is refusing connections" This happens evrytime and is very fraustrating.

    I am working on an HP Compaq laptop using a wi-fi connection to o2 broadband.
    Here is an example that I opened in my Outlook account this evening,
    Frylands Wood Scout Outdoor Centre is a 62.5 acre campsite located in the green belt on the outskirts of London. In the main, the camping is arranged in the wooded clearings. Facilities ranging from a single patrol to a District or even County Camp. 44 individual sites / 5 larger grassed areas; Halls Folley, Activity Field, Mole ... Read Full Article...
    Posted: 07 Mar 2011 08:45 am
    When I click onto the "Read Full Article..." tab I go to the Mozilla Firefox page which says there is a problem loading page - Mozilla Firefox, and then get the "The proxy server is refusing connections" and the o2 Broadband assistant then kicks in and starts trying to find the connections even though o2 broadband is connected.
    I have tried re-installing Firefox but this does not improve the situation which is frustrating as I have to send everything to my work account so that I can read any further information.

    You can find the connection settings in Tools > Options > Advanced : Network : Connection<br />
    If you do not need to use a proxy to connect to internet then select "No Proxy"
    See "Firefox connection settings":
    * [[Firefox cannot load websites but other programs can]]

Maybe you are looking for

  • ITUNES WONT OPEN AT ALL - PLEASE HELP!

    Can someone please help me! I downloaded itunes 6 about a week ago, its been working fine up until last night. Everytime I go to open itunes I get the annoying error message - 'itunes has encountered a problem and needs to close'. I have tried re-ins

  • Port Forwarding and Internet Sharing

    Hey all, I have a wireless network set up through a Time Capsule. My iBook is connected to this network via Airport. In addition, I have a computer with no wireless connected to my laptop via Ethernet. I have my System Preferences set up to Share Int

  • How to link a java program and a music file played

    i wanna know how do i read values of music (mp3 or any other format) that are played ? for example if if there is a sound like "pimm" ,there should be a value(hex,dec etc) for it that is used by the player to play it.

  • Polling for XML data

    My task is to design a module which will be pollong an url for some xml data. The data will be updated from the source at around 19.30 (+/- 1 hour) every day. I'm on wls 6.1 with portal in a J2EE application. Anybody know a pattern for this? Any sugg

  • Fusion Middleware - Installing Forms & Reports Developer in separate server

    Hi, I installed Forms & Reports Server (without developer tools) on one server. Now I want to install only Forms and Reports developer in another server. Can anybody tell me how to achieve this or from where I can get some reference document particul