crossbario / autobahn-testsuite

Autobahn WebSocket protocol testsuite
https://crossbar.io/autobahn/
Apache License 2.0
1k stars 84 forks source link

Connection to ws://127.0.0.1:9001 failed #67

Closed provegard closed 7 years ago

provegard commented 7 years ago

I'm trying to create a tiny websocket server for fun, and my intention is to test-drive the implementation using autobahn-testsuite.

My server can currently read the opening handshake and respond to it. When I connect using autobahn, I see the following server debug output:

Listening
Accepted
<== User-Agent: AutobahnTestSuite/0.7.5-0.10.9
<== Host: 127.0.0.1:9001
<== Upgrade: WebSocket
<== Connection: Upgrade
<== Pragma: no-cache
<== Cache-Control: no-cache
<== Sec-WebSocket-Key: RuddT44x8xd8fWC2l/DLVw==
<== Sec-WebSocket-Version: 13
Client key = RuddT44x8xd8fWC2l/DLVw==
Response key = 1OTHpabglBS7A1ITeq5F2Kvx6Eg=
==> HTTP/1.1 101 Switching Protocols
==> Upgrade: websocket
==> Connection: Upgrade
==> Sec-WebSocket-Accept: 1OTHpabglBS7A1ITeq5F2Kvx6Eg=
==>

However, autobahn says:

Connection to ws://127.0.0.1:9001 failed (Connection was refused by other side: 10061: No connection could be made because the target machine actively refused it..)
Unhandled Error
Traceback (most recent call last):
  File "c:\python27\lib\site-packages\twisted\python\log.py", line 103, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "c:\python27\lib\site-packages\twisted\python\log.py", line 86, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "c:\python27\lib\site-packages\twisted\python\context.py", line 122, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "c:\python27\lib\site-packages\twisted\python\context.py", line 85, in callWithContext
    return func(*args,**kw)
--- <exception caught here> ---
  File "c:\python27\lib\site-packages\twisted\internet\selectreactor.py", line 149, in _doReadOrWrite
    why = getattr(selectable, method)()
  File "c:\python27\lib\site-packages\twisted\internet\tcp.py", line 551, in doConnect
    self.failIfNotConnected(error.getConnectError((err, strerror(err))))
  File "c:\python27\lib\site-packages\twisted\internet\tcp.py", line 453, in failIfNotConnected
    self.connector.connectionFailed(failure.Failure(err))
  File "c:\python27\lib\site-packages\twisted\internet\base.py", line 1128, in connectionFailed
    self.factory.clientConnectionFailed(self, reason)
  File "c:\python27\lib\site-packages\autobahntestsuite\fuzzing.py", line 1302, in clientConnectionFailed
    self.createReports()
  File "c:\python27\lib\site-packages\autobahntestsuite\fuzzing.py", line 469, in createReports
    self.createMasterReportHTML(self.outdir)
  File "c:\python27\lib\site-packages\autobahntestsuite\fuzzing.py", line 670, in createMasterReportHTML
    agent_case_report_file = self.makeAgentCaseReportFilename(agentId, caseId, ext = 'html')
  File "c:\python27\lib\site-packages\autobahntestsuite\fuzzing.py", line 498, in makeAgentCaseReportFilename
    return self.cleanForFilename(agentId) + "_case_" + c + "." + ext
  File "c:\python27\lib\site-packages\autobahntestsuite\fuzzing.py", line 487, in cleanForFilename
    s0 = ''.join([c if c in "abcdefghjiklmnopqrstuvwxyz0123456789" else " " for c in str.strip().lower()])
exceptions.AttributeError: 'NoneType' object has no attribute 'strip'

Unhandled Error
Traceback (most recent call last):
  File "c:\python27\lib\site-packages\autobahntestsuite\wstest.py", line 272, in start
    reactor.run()
  File "c:\python27\lib\site-packages\twisted\internet\base.py", line 1243, in run
    self.mainLoop()
  File "c:\python27\lib\site-packages\twisted\internet\base.py", line 1255, in mainLoop
    self.doIteration(t)
  File "c:\python27\lib\site-packages\twisted\internet\selectreactor.py", line 143, in doSelect
    _logrun(selectable, _drdw, selectable, method)
--- <exception caught here> ---
  File "c:\python27\lib\site-packages\twisted\python\log.py", line 103, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "c:\python27\lib\site-packages\twisted\python\log.py", line 86, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "c:\python27\lib\site-packages\twisted\python\context.py", line 122, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "c:\python27\lib\site-packages\twisted\python\context.py", line 85, in callWithContext
    return func(*args,**kw)
  File "c:\python27\lib\site-packages\twisted\internet\selectreactor.py", line 154, in _doReadOrWrite
    self._disconnectSelectable(selectable, why, method=="doRead")
  File "c:\python27\lib\site-packages\twisted\internet\posixbase.py", line 258, in _disconnectSelectable
    selectable.connectionLost(failure.Failure(why))
  File "c:\python27\lib\site-packages\twisted\internet\tcp.py", line 476, in connectionLost
    self.failIfNotConnected(error.ConnectError(string=reason))
  File "c:\python27\lib\site-packages\twisted\internet\tcp.py", line 453, in failIfNotConnected
    self.connector.connectionFailed(failure.Failure(err))
  File "c:\python27\lib\site-packages\twisted\internet\base.py", line 1128, in connectionFailed
    self.factory.clientConnectionFailed(self, reason)
  File "c:\python27\lib\site-packages\autobahntestsuite\fuzzing.py", line 1297, in clientConnectionFailed
    print "Connection to %s failed (%s)" % (self.spec["servers"][self.currServer]["url"], reason.getErrorMessage())
exceptions.IndexError: list index out of range

I realize that my server may do a lot of things wrong at this point, but I'm a bit confused by the error from autobahn. Obviously the connection wasn't refused.

What am I missing?

provegard commented 7 years ago

Never mind, I thought autobahn would do something more on the first connection and I didn't accept new ones. I need to read up better on how autobahn behaves!