         # File lib/eventmachine.rb, line 536
    536:   def EventMachine::start_server server, port=nil, handler=nil, *args, &block
    537:
    538:     begin
    539:       port = Integer(port)
    540:     rescue ArgumentError, TypeError
    541:       # there was no port, so server must be a unix domain socket
    542:       # the port argument is actually the handler, and the handler is one of the args
    543:       args.unshift handler if handler
    544:       handler = port
    545:       port = nil
    546:     end if port
    547:
    548:     klass = if (handler and handler.is_a?(Class))
    549:       raise ArgumentError, 'must provide module or subclass of EventMachine::Connection' unless Connection > handler
    550:       handler
    551:     else
    552:       Class.new( Connection ) {handler and include handler}
    553:     end
    554:
    555:     arity = klass.instance_method(:initialize).arity
    556:     expected = arity >= 0 ? arity : -(arity + 1)
    557:     if (arity >= 0 and args.size != expected) or (arity < 0 and args.size < expected)
    558:       raise ArgumentError, "wrong number of arguments for #{klass}#initialize (#{args.size} for #{expected})"
    559:     end
    560:
    561:     s = if port
    562:           start_tcp_server server, port
    563:         else
    564:           start_unix_server server
    565:         end
    566:     @acceptors[s] = [klass,args,block]
    567:     s
    568:   end