Quick and dirty… open two shell iex sessions:

In first session (this will be the server):

iex(1)> {:ok, socket} = :gen_tcp.listen(3000, [:binary, active: false])
{:ok, #Port<0.6>}
iex(2)> {:ok, data} = :gen_tcp.recv(socket, 0)

From the second session:

iex(1)> {:ok, server} = :gen_tcp.connect({0,0,0,0}, 3000, [])
{:ok, #Port<0.6>}
iex(2)> :gen_tcp.send(server, "hello")
:ok

Back in the first session:

iex(3)> {:ok, data} = :gen_tcp.recv(client, 0) 
{:ok, "hello"}