Thanks for your reply, Nelson.
Here is the code that is in charge of the communication:
/**
* This thread reads information from the SSLSocket and hands it over
to the Socket in order to display the
* results in the browser
*/
private class SSLSocketToSocketRedirector extends Thread
{
protected SSLSocket in = null;
protected OutputStream out = null;
int bufferLength = 4096;
private byte[] buffer = new byte[bufferLength];
public boolean run=false;
public SSLSocketToSocketRedirector( SSLSocket in, OutputStream out )
{
this.in = in;
this.out = out;
}
public void run()
{
run=true;
try{
while(run)
{
int length = in.read(buffer, 0,
bufferLength);//Reads the data (using the
org.mozilla.jss.ssl.SSLSocket.read() method)
if( length == 0 )
{ System.out.println(">>>EOF read,
breaking!");
break;
}
out.write(buffer, 0 ,length);//Write the info
into the Socket
}
run=false;
}
catch( Exception e )
{
logger.error("IOException: "+e,e);
run=false;
}
finally
{
try { in.close(); } catch( Exception ignored ) {}
try { out.close(); } catch( Exception ignored ) {}
}
}
}
/**
*This thread reads information from the Socket and hands it over to
the SSLSocket
*/
private class SocketToSSLSocketRedirector extends Thread
{
protected InputStream in = null;
protected SSLOutputStream out = null;
int bufferLength = 4096;
private byte[] buffer = new byte[bufferLength];
public boolean run=false;
public SocketToSSLSocketRedirector( InputStream in, SSLOutputStream
out )
{
this.in = in;
this.out = out;
}
public void run()
{
run=true;
try{
while(run)
{
int length = in.read(buffer);
if( length == 0 )
{ System.out.println(">>>EOF read,
breaking!");
break;
}
out.write(buffer);
}
run=false;
}
catch( IOException e )
{
logger.error("IOException: "+e,e);
run=false;
}
finally
{
try { in.close(); } catch( Exception ignored ) {}
try { out.close(); } catch( Exception ignored ) {}
}
}
}
I create one instance of each thread :
c2s = new SocketToSSLSocketRedirector(
clientSocket.getInputStream(), sslOS);
c2s.start();
SSLInputStream sslIS = new SSLInputStream(targetSocket);
SSLSocketToSocketRedirector s2c = new
SSLSocketToSocketRedirector( targetSocket, clientSocket.getOutputStream());
s2c.start();
but the the threads do not read from or write to the SSL socket, the error I
posted is displayed while trying to read or write.
thanks again.
(I am using JavaHTTPProxy code (http://sourceforge.net/projects/wpg-proxy/))
_________________________________________________________________
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
https://signup.live.com/signup.aspx?id=60969
--
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto