# File test/sockutils.rb, line 22 def tcp_socketpair socket = TCPServer.open('localhost', 0) begin family, port, host, addr = socket.addr cli_sock = TCPSocket.open('localhost', port) svr_sock = socket.accept setsockopt(cli_sock) setsockopt(svr_sock) return cli_sock, svr_sock ensure socket.close if socket end end