Exemplo n.º 1
0
  public static void main(String[] args) throws Exception {
    // CREATE CLIENT INSTANCES
    MailClient myClient = new MailClient("admin", "localhost", true);

    // myClient.checkInbox(MailClient.SHOW_MESSAGES);

    Thread.sleep(500); // Let the server catch up

    myClient.sendMessage("test@localhost", "Testing it is okkk", "This is a test message");
    /*
     * gmaile göndermek için james in adresi ile domain adresi ayný olmasý lazým, yoksa gmail reverse kontrol ile maili almaz.
     */

    Thread.sleep(500); // Let the server catch up

    myClient.checkInbox(MailClient.SHOW_MESSAGES);
  }
Exemplo n.º 2
0
 public static void sendMessageToServer() {
   System.out.println("Enter your address:");
   String address1 = "";
   Scanner sc = new Scanner(System.in);
   address1 = sc.nextLine();
   c1.set_address(address1);
   //			System.out.println("Enter address2: ");
   //			String address2="";
   //			address2=sc.nextLine();
   //			c1.set_address(address2);
   System.out.println("Enter any text");
   String textFromScan = "";
   textFromScan = sc.nextLine();
   System.out.println("your address is: " + address1 + " text is " + textFromScan);
   c1.setText(textFromScan);
   c1.set_isSender(true);
   c1.sendToServer();
 }
Exemplo n.º 3
0
    /** Metodo que prueba el segundo apartado de la actividad 0170. */
    public void test1() {
      MailServer gmail = new MailServer();
      MailClient cliente1 = new MailClient(gmail, "*****@*****.**");
      MailClient cliente2 = new MailClient(gmail, "*****@*****.**");

      cliente1.sendMailItem("*****@*****.**", "Hola", "Hola Maria");
      cliente2.getNextMailItemAndSendAutomaticRespond();
      cliente1.printNextMailItem();

      cliente2.getNextMailItemAndSendAutomaticRespond();
      cliente1.printNextMailItem();
    }
Exemplo n.º 4
0
  public static void main(String[] args) throws Exception {
    // CREATE CLIENT INSTANCES
    MailClient redClient = new MailClient("boreas", "localhost");
    MailClient greenClient = new MailClient("green", "localhost");
    MailClient blueClient = new MailClient("blue", "localhost");

    // CLEAR EVERYBODY'S INBOX
    redClient.checkInbox(MailClient.CLEAR_MESSAGES);
    greenClient.checkInbox(MailClient.CLEAR_MESSAGES);
    blueClient.checkInbox(MailClient.CLEAR_MESSAGES);
    Thread.sleep(500); // Let the server catch up

    // SEND A COUPLE OF MESSAGES TO BLUE (FROM RED AND GREEN)
    redClient.sendMessage(
        "*****@*****.**",
        "Good evening",
        "We were working hard, but have confused with configurations((");
    greenClient.sendMessage("blue@localhost", "Testing blue from green", "This is a test message");
    Thread.sleep(50000); // Let the server catch up

    // LIST MESSAGES FOR BLUE (EXPECT MESSAGES FROM RED AND GREEN)
    blueClient.checkInbox(MailClient.SHOW_AND_CLEAR);
  }
Exemplo n.º 5
0
 @Test
 public void shouldCheckNetwork() {
   mailClient.send(mailContent);
   verify(mailService, times(1)).checkNetwork();
 }
Exemplo n.º 6
0
 @Test
 public void connectionRefusedTest(TestContext testContext) {
   this.testContext = testContext;
   testException(MailClient.createNonShared(vertx, new MailConfig("localhost", 1588)));
 }