code: protected ProxyMessage exchange(ProxyMessage request)
                             throws SocksException{
        ProxyMessage reply;
        try{
           request.write(out);
           reply = formMessage(in);
        }catch(SocksException s_ex){
           throw s_ex;
        }catch(IOException ioe){
           throw(new SocksException(SOCKS_PROXY_IO_ERROR,""+ioe));
        }
        return reply;
     }
docs: Sends the request reads reply and returns it
  throws exception if something wrong with IO
  or the reply code is not zero