+package subastas;
+
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+
+import org.omg.CORBA.*;
+
+public class Cliente {
+
+ /**
+ * @param args
+ * @throws IOException
+ */
+ public static void main(String[] args) throws IOException {
+ ORB orb = ORB.init(args, null);
+
+ LineNumberReader input = new LineNumberReader(new FileReader("server.ior"));
+ String ior = input.readLine();
+
+ org.omg.CORBA.Object obj = orb.string_to_object(ior);
+
+ gestorSubastas gs = gestorSubastasHelper.narrow(obj);
+
+
+ //usando el objecto gs
+ coordinadorSubasta cs = gs.crearSubasta((float)10.0, "clip rojo");
+ System.out.println(cs.valor());
+ System.out.println(cs.descripcion());
+ System.out.println(cs.estado());
+
+ clienteSubastas cl1 = new clienteSubastas("cliente1");
+ clienteSubastas cl2 = new clienteSubastas("cliente2");
+ cs.inscribirCliente(cl1);
+ cs.inscribirCliente(cl2);
+
+ cs.abrirSubasta();
+ //deberia estar abierto
+ System.out.println(cs.estado());
+ cs.pujar(21, cl1);
+ if(cs.pujar(20, cl2)){
+ System.out.println(cl2.identificacion() + ": mi puja es más alta");
+ }
+ cs.ultimaPuja(cl2);
+ cs.ultimaPuja(cl1);
+ System.out.println(cs.ganador().identificacion());
+
+ boolean salir = false;
+ String comando = "";
+ while(!salir){
+ try{
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
+ comando = br.readLine();
+ }catch(Exception e){ e.printStackTrace();}
+ if(comando.equals("salir")){
+ salir = true;
+ break;
+ }
+ else if(comando.contains("crear")){
+ String[] partesDelComando = comando.split(" ");
+ for(int i=0; i<partesDelComando.length; i++){
+ System.out.println(partesDelComando[i]);
+ }
+ }
+ }
+ }
+
+}