2011/10/10 Konstantin Kolinko <knst.koli...@gmail.com>:
> 2011/10/9 Olivier Lamy <ol...@apache.org>:
>> tomcat.getConnector().setPort( 0 );
>
> 1) Look at how TomcatBaseTest assigns subsequent port numbers,
> starting with 8001.
>
> http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java?view=markup#l84
>
>
> 2) While the proposed feature may have some usage, I think that I
> would want more control in what range the opened port number will be.
>
> Just setting a "0" would not provide such control.
>
>
> 3) There are several Connector/Endpoint implementations in Tomcat.
> While java.net.ServerSocket does support port number of "0",  I am not
> sure that APR-based implementation does allow it.
Sure but the use case is just to start a http/https (apr can be
omitted) connector on any random free port, do some unit test and stop
it.
IMHO it's a valid use case (and with it folks will be able to use
tomcat rather than an other servlet container which has this feature
available :-) ).
See the code snippet I have pointed, the code to write for using
tomcat is really smaller/smarter (except all hacking I have to write
due to the restriction on port).
>
>
> 2011/10/9 Mark Thomas <ma...@apache.org>:
>> On 09/10/2011 15:08, Olivier Lamy wrote:
>>> Hello,
>>> I'd like to be able to use a random port when using embedded Tomcat in
>>> unit tests to test servlets.
>>> Currently it's "locked" by a test in Connector#startInternal.
>>> Is it intentional ?
>>
>> svn blame would have answered that for you.
>>
>
> To be specific, that was
> http://svn.apache.org/viewvc?view=revision&revision=1147949
>
>
> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>



-- 
Olivier Lamy
Talend : http://talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to