voodoodyne / subethasmtp

SubEtha SMTP is a Java library for receiving SMTP mail
Other
344 stars 138 forks source link

SMTPClient makes it hard to extend to use SSL #42

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Because there's no way to replace the creation of the initial client socket its 
nearly impossible to extend the SmartClient to use SSL. 

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
3.1.5

Please provide any additional information below.
I've attached a modified version of SMTPClient with a new public method called 
"Socket createSocket()" which allows overriding when SSL is used. This should 
also make it easier to support STARTTLS from the client side as well.

Original issue reported on code.google.com by reidn...@gmail.com on 21 Mar 2011 at 8:01

Attachments:

GoogleCodeExporter commented 9 years ago
The socket is created in the constructor, so createSocket, which is intended to 
be overridden in a subclass is also called from the base class constructor. 
(I.e. createSocket will run before its instance becomes initialized.) A 
protected constructor with an additional Socket parameter seems to be a simple 
and safe solution. 

Original comment by hontvari@flyordie.com on 23 Mar 2011 at 1:02

GoogleCodeExporter commented 9 years ago
Good point. I'd vote for making createSocket static rather than a constructor 
parameter; though I would be fine with the later as long as the parameter is 
also exposed in SmartClient's constructor as well (so that its easy to provide 
the SSLSocket and to extends SmartClient.

Original comment by reidn...@gmail.com on 23 Mar 2011 at 3:45

GoogleCodeExporter commented 9 years ago
Fixed in r411. Please verify.

Original comment by hontvari@flyordie.com on 28 Mar 2011 at 1:20

GoogleCodeExporter commented 9 years ago
Sorry about the really long delay in verifying this but it is fixed (tested w/ 
3.1.6 release)

Original comment by reidn...@gmail.com on 21 Jul 2011 at 2:57

GoogleCodeExporter commented 9 years ago

Original comment by hontvari@flyordie.com on 21 Jul 2011 at 3:07