
public class TestMsg
{
  public static void main(String args[])
  {
    Port port= new Port();
    Thread prod= new Producer(port);
    prod.start();
    System.out.println("Voy a recibir el mensaje");
    Msg msg= port.receive();
    System.out.println("Ok, recibi el mensaje"+msg);
    msg.reply();
  }
}

class Producer extends Thread
{
  Port port;

  public Producer(Port port) { this.port= port; }

  public void run()
  {
    Msg msg= new Msg();
    System.out.println("Voy a enviar el mensaje");
    msg.send(port);
    System.out.println("Ok, envie el mensaje");
  }
}
