Exemple #1
0
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)
}
Exemple #2
0
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())
}
Exemple #3
0
func TestServerFailsWithInvalidBind(t *testing.T) {
	s, err := server.New("256.256.256.256:1234")

	assert.IsType(t, &server.Server{}, s)
	assert.NotNil(t, err)
}
Exemple #4
0
// 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)
}