Client.java 891 Bytes
Newer Older
Michele Fiori's avatar
Michele Fiori committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
package actor;

import it.ewlab.actor.ActorOuterClass.Actor;

import java.io.IOException;
import java.net.Socket;

public class Client {

    public static void main(String[] args) throws IOException {

        Socket s = new Socket("localhost", 9999);

        Actor actor =
                Actor.newBuilder()
                        .setName("Christian")
                        .setSurname("Bale")
                        .setSex(Actor.Sex.MALE)
                        .addMovie(Actor.Movie.newBuilder()
                                .setTitle("The Prestige")
                                .setYear(2006))
                        .addMovie(Actor.Movie.newBuilder()
                                .setTitle("The Dark Knight")
                                .setYear(2008))
                        .build();

        actor.writeTo(s.getOutputStream());

        s.close();


    }
}