<div dir="ltr">David,<div><br></div><div>You may also wish to take a look at Proxy65, which is a socks5 proxy specifically for XMPP XEP-0065.  I have no idea how complete or correct it is, and it's pretty old, but it might be helpful.</div>
<div><br></div><div><a href="https://code.google.com/p/proxy65/">https://code.google.com/p/proxy65/</a><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Nov 16, 2013 at 2:28 PM, David Stainton <span dir="ltr"><<a href="mailto:dstainton415@gmail.com" target="_blank">dstainton415@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Jean-Paul,<br>
<br>
Thanks for all the info, observations about the existing code and for<br>
the coding advice!<br>
<br>
I think I should only implement the socks 5 server side<br>
since txsocksx seems to have the client implementation covered.<br>
Some of the Tor developers use it...<br>
<br>
I'm not used to test driven development. I'll give it a try and<br>
implement the SOCKSv5 server functionality...<br>
<br>
<br>
Cheers!<br>
<span class="HOEnZb"><font color="#888888"><br>
David<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Sat, Nov 16, 2013 at 11:44 AM,  <<a href="mailto:exarkun@twistedmatrix.com">exarkun@twistedmatrix.com</a>> wrote:<br>
> On 06:14 pm, <a href="mailto:dstainton415@gmail.com">dstainton415@gmail.com</a> wrote:<br>
>><br>
>> Hi, I'd like to help out and write unit tests for the Socks v5 code in<br>
>> this ticket:<br>
>> <a href="https://twistedmatrix.com/trac/ticket/1330" target="_blank">https://twistedmatrix.com/trac/ticket/1330</a><br>
>><br>
>> Should I write something very similar to this?? ::<br>
>> <a href="http://twistedmatrix.com/trac/browser/trunk/twisted/test/test_socks.py" target="_blank">http://twistedmatrix.com/trac/browser/trunk/twisted/test/test_socks.py</a><br>
>><br>
>> My goal is getting socksv5 client and server code merged to mainline<br>
>> Twisted with unit tests.<br>
><br>
><br>
><br>
> twisted/test/test_socks.py is a bad example of a test suite.  Here are the<br>
> things about it you should not emulate:<br>
><br>
>  * It has documentation that is far from complete.  Documentation is just as<br>
> important in unit tests as elsewhere.  In particular, documenting the intent<br>
> of every test method is critical otherwise the test suite is very difficult<br>
> to maintain.<br>
><br>
>  * It exercises too much code in each test method.  Well written test<br>
> methods do a single very simple thing.  A good rule of thumb is that there<br>
> should only be one `TestCase.assert...` method call in each test method.<br>
><br>
>  * It uses some `TestCase.assert...` methods which are deprecated or soon to<br>
> be deprecated.  `assert_` is the main offender here.<br>
><br>
>  * It doesn't completely cover the implementation (probably because the<br>
> implementation wasn't developed test-driven).  You can achieve full test<br>
> coverage without doing test-driven development but it takes more discipline.<br>
> I suggest doing a test-driven implementation of the SOCKSv5 functionality<br>
> you want (the easy approach to this is to start writing tests, then copy the<br>
> *smallest* possible piece of the existing, untested implementation into your<br>
> new implementation to make those tests pass; repeat until you have all of<br>
> the desired functionality).<br>
><br>
>  * `StringTCPTransport` seems redundant.  `StringTransport` offers all of<br>
> this functionality already.<br>
><br>
>  * Many names used in the module don't follow the Twisted name convention<br>
> (most obviously, "under_scores" are used throughout rather than<br>
> "camelCase").<br>
><br>
>  * Native strings are used to represent byte strings throughout.<br>
><br>
>  * The protocol interface is uniformly misused (it should call<br>
> `makeConnection` not `connectionMade`)<br>
><br>
> Hope this helps,<br>
> Jean-Paul<br>
><br>
> _______________________________________________<br>
> Twisted-Python mailing list<br>
> <a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
> <a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
<br>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>--<div>Kevin Horn</div>
</div>