I think I've hit one of those cases where AMP really seems to want everything (locator, receiver, sender) to be an instance of t.p.amp.AMP :-(
I've written some code that tries to multiplex stream transports over AMP:
The repo contains an example server and client, which demonstrate the issue:
In order to do some of this multiplexing, I need access to the protocol instance inside the responder on the server side. Fortunately, I already had some code that exposed box senders (after a lot of advice from Glyph). I modified it to expose the protocol as well:
However, it turns out fromBox gets called with the *responder locator* as the "proto" argument, not the actual protocol.
The server has a pudb call that makes it easy (?!) to trace this down. The CommandLocator class, inside doit (a function defined in _wrapWithSerialization) passes "self" to command.parseArguments:
This is the part where I think the contract is broken, since parseArguments claims to want the protocol (well, it says it wants the AMP protocol, which, subclassing everything, is also all of the things, of course), but receives the responder locator.
What am I doing wrong? Is this a bug?