private void updateProxy() {
    String host = _hostname.getText().toString().trim();
    if (host.length() == 0) {
      _status.setText("No hostname");
      return;
    }

    String s =
        "hello:tcp -h "
            + host
            + " -p 10000:ssl -h "
            + host
            + " -p 10001:udp -h "
            + host
            + " -p 10000";
    com.zeroc.Ice.ObjectPrx prx = _communicator.stringToProxy(s);
    prx = _deliveryMode.apply(prx);
    int timeout = _timeoutSlider.getValue();
    if (timeout != 0) {
      prx = prx.ice_invocationTimeout(timeout);
    }
    _helloPrx = Demo.HelloPrx.uncheckedCast(prx);

    //
    // The batch requests associated to the proxy are lost when we
    // update the proxy.
    //
    _flush.setEnabled(false);

    _status.setText("Ready");
  }
 com.zeroc.Ice.ObjectPrx apply(com.zeroc.Ice.ObjectPrx prx) {
   switch (this) {
     case TWOWAY:
       {
         prx = prx.ice_twoway();
         break;
       }
     case TWOWAY_SECURE:
       {
         prx = prx.ice_twoway().ice_secure(true);
         break;
       }
     case ONEWAY:
       {
         prx = prx.ice_oneway();
         break;
       }
     case ONEWAY_BATCH:
       {
         prx = prx.ice_batchOneway();
         break;
       }
     case ONEWAY_SECURE:
       {
         prx = prx.ice_oneway().ice_secure(true);
         break;
       }
     case ONEWAY_SECURE_BATCH:
       {
         prx = prx.ice_batchOneway().ice_secure(true);
         break;
       }
     case DATAGRAM:
       {
         prx = prx.ice_datagram();
         break;
       }
     case DATAGRAM_BATCH:
       {
         prx = prx.ice_batchDatagram();
         break;
       }
   }
   return prx;
 }