public InetGuacamoleSocket(String hostname,int port) throws GuacamoleException {
  try {
    logger.debug("Connecting to guacd at {}:{}.",hostname,port);
    SocketAddress address=new InetSocketAddress(InetAddress.getByName(hostname),port);
    sock=new Socket();
    sock.connect(address,SOCKET_TIMEOUT);
    sock.setSoTimeout(SOCKET_TIMEOUT);
    reader=new ReaderGuacamoleReader(new InputStreamReader(sock.getInputStream(),"UTF-8"));
    writer=new WriterGuacamoleWriter(new OutputStreamWriter(sock.getOutputStream(),"UTF-8"));
  }
 catch (  SocketTimeoutException e) {
    throw new GuacamoleUpstreamTimeoutException("Connection timed out.",e);
  }
catch (  IOException e) {
    throw new GuacamoleServerException(e);
  }
}

public InetGuacamoleSocket ( String hostname , int port ) throws GuacamoleException { try { logger . debug ( "Connecting to guacd at {}:{}." , hostname , port ) ; SocketAddress address = new InetSocketAddress ( InetAddress . getByName ( hostname ) , port ) ; sock = new Socket ( ) ; sock . connect ( address , SOCKET_TIMEOUT ) ; sock . setSoTimeout ( SOCKET_TIMEOUT ) ; reader = new ReaderGuacamoleReader ( new InputStreamReader ( sock . getInputStream ( ) , "UTF-8" ) ) ; writer = new WriterGuacamoleWriter ( new OutputStreamWriter ( sock . getOutputStream ( ) , "UTF-8" ) ) ; } catch ( SocketTimeoutException e ) { throw new GuacamoleUpstreamTimeoutException ( "Connection timed out." , e ) ; } catch ( IOException e ) { throw new GuacamoleServerException ( e ) ; } }
creates a new inetguacamolesocket which reads and writes instructions to the guacamole instruction stream of the guacamole proxy server running at the given hostname and port .
