func TestNewServerConstructsServerWithValidBind(t *testing.T) { s, err := server.New("127.0.0.1:1234") defer s.Close() assert.IsType(t, &server.Server{}, s) assert.Nil(t, err) }
func TestListenGetsNewClients(t *testing.T) { s, err := server.New("127.0.0.1:1935") assert.Nil(t, err) go s.Accept() defer s.Close() _, err = net.Dial("tcp", "127.0.0.1:1935") assert.Nil(t, err) assert.IsType(t, &client.Client{}, <-s.Clients()) }
func TestServerFailsWithInvalidBind(t *testing.T) { s, err := server.New("256.256.256.256:1234") assert.IsType(t, &server.Server{}, s) assert.NotNil(t, err) }
// NewServer returns a new RMTP server, listening on the given bind string. If // an error was encountered in binding to that address, it will be returned, // along with a nil server. // // For more information, see package github.com/WatchBeam/rtmp/server. func NewServer(bind string) (*server.Server, error) { return server.New(bind) }