Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
25 lines (15 sloc) 550 Bytes
-module(port_tests).
-include_lib("eunit/include/eunit.hrl").
echo_port_open_close_test() ->
Port = 50001,
Type = echo,
{ok,Openport} = port:open(Port,Type),
assert_port_open(Port),
port:close(Openport),
assert_port_closed(Port).
%% ------------------------------------------------------------
assert_port_open(Port) ->
{ok,Sock} = gen_tcp:connect("localhost",Port,[]),
gen_tcp:close(Sock).
assert_port_closed(Port) ->
{error,econnrefused} = gen_tcp:connect("localhost",Port,[]).
Jump to Line
Something went wrong with that request. Please try again.