HTTPS support..New to netty
keerthik
keerthi.kamalapuri at yellowbook.com
Wed Mar 24 17:09:55 EDT 2010
Hello,
I am trying to use HTTPS in netty, I saw the example SecureChatClient
example and I am trying to modify the SecureChatClient example to read the
HTML coming from the secure site like the following example
***************Usual Java connection *************************/
URL url = new URL("https://www.myhost.com/"); // replace with real https
websites
URLConnection conn = url.openConnection();
//InputStream istream = conn.getInputStream();
BufferedReader rd = new BufferedReader(new
InputStreamReader(conn.getInputStream()));
String line;
while ((line = rd.readLine()) != null){
System.out.println(line);
}
************************************************************
Now changed Netty's SecureChatClient code to do the following
String host = "www.myhost.com";
int port = Integer.parseInt("80");
// Configure the client.
ClientBootstrap bootstrap = new ClientBootstrap(
new NioClientSocketChannelFactory(
Executors.newCachedThreadPool(),
Executors.newCachedThreadPool()));
SecureChatClientHandler handler = new SecureChatClientHandler();
bootstrap.setPipelineFactory(new
SecureChatPipelineFactory(handler));
// Start the connection attempt.
ChannelFuture future = bootstrap.connect(new InetSocketAddress(host,
port));
// Wait until the connection attempt succeeds or fails.
Channel channel = future.awaitUninterruptibly().getChannel();
if (!future.isSuccess()) {
future.getCause().printStackTrace();
bootstrap.releaseExternalResources();
return;
}
Now I want to read the HTML how do I do,
SecureChatClientHandler.receiveMessage method is never invoked.
How to I read the html the following?
BufferedReader rd = new BufferedReader(new
InputStreamReader(conn.getInputStream()));
String line;
while ((line = rd.readLine()) != null){
System.out.println(line);
}
When I execute the above script, I get this message
Mar 24, 2010 5:01:29 PM
org.jboss.netty.example.securechat.SecureChatClientHandler handleUpstream
INFO: [id: 0x017c96a9] OPEN
Mar 24, 2010 5:01:30 PM
org.jboss.netty.example.securechat.SecureChatClientHandler handleUpstream
INFO: [id: 0x017c96a9, /10.6.239.184:5914 => www.xyz.com/10.0.0.0:80] BOUND:
/10.6.239.184:5914
Mar 24, 2010 5:01:30 PM
org.jboss.netty.example.securechat.SecureChatClientHandler handleUpstream
INFO: [id: 0x017c96a9, /10.6.239.184:5914 => www.xyz.com/10.0.0.0:80]
CONNECTED: www.xyz.com/10.0.0.0:80
Mar 24, 2010 5:01:34 PM
org.jboss.netty.example.securechat.SecureChatClientHandler handleUpstream
INFO: [id: 0x017c96a9, /10.6.239.184:5914 => /10.0.0.0:80] DISCONNECTED
Mar 24, 2010 5:01:34 PM
org.jboss.netty.example.securechat.SecureChatClientHandler handleUpstream
INFO: [id: 0x017c96a9, /10.6.239.184:5914 => www.xyz.com/10.0.0.0:80]
UNBOUND
Mar 24, 2010 5:01:34 PM
org.jboss.netty.example.securechat.SecureChatClientHandler handleUpstream
INFO: [id: 0x017c96a9, /10.6.239.184:5914 => www.xyz.com/10.0.0.0:80] CLOSED
Please help. I just want to read the HTMl coming from the https connection.
Thank u
Keerthi
--
View this message in context: http://n2.nabble.com/HTTPS-support-New-to-netty-tp4793904p4793904.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list