adamfisk/LittleProxy — Issue #19: SslLauncher throws SSLException
Author: jasondiprinzio
Created: 2011-12-05 22:42:05+00:00
State: open

I started little proxy for http and I can intercept requests just fine.
When I start the SslLauncher and try to proxy requests via HTTPS I get this stacktrace:

$ java -Dlog4j.configuration=file:///home/jason/Projects/littleproxy/src/main/resources/log4j.properties -cp target/littleproxy-0.5-SNAPSHOT-jar-with-dependencies.jar:. org.littleshoot.proxy.SslLauncher 8989
About to start SSL server on port: 8989
0 2011-12-05 17:38:25,910 INFO [main] proxy.SelfSignedKeyStoreManager.resetStores (SelfSignedKeyStoreManager.java:40) - Not deleting keystore
About to start...
24 2011-12-05 17:38:25,934 INFO [main] proxy.DefaultHttpProxyServer.start (DefaultHttpProxyServer.java:121) - Starting proxy on port: 8989
29 2011-12-05 17:38:25,939 INFO [main] proxy.HttpServerPipelineFactory. (HttpServerPipelineFactory.java:89) - Creating server with keystore manager: org.littleshoot.proxy.SelfSignedKeyStoreManager@5b6df84b
59 2011-12-05 17:38:25,969 INFO [main] proxy.HttpServerPipelineFactory.setupJmx (HttpServerPipelineFactory.java:171) - Registering MBean with name: org.littleshoot.proxy:type=HttpServerPipelineFactory-HttpServerPipelineFactory202077946
3554 2011-12-05 17:38:29,464 INFO [New I/O server boss #1 ([id: 0x2b2d96f2, /0:0:0:0:0:0:0:0:8989])] proxy.HttpServerPipelineFactory.getPipeline (HttpServerPipelineFactory.java:207) - Accessing pipeline
3555 2011-12-05 17:38:29,465 INFO [New I/O server boss #1 ([id: 0x2b2d96f2, /0:0:0:0:0:0:0:0:8989])] proxy.HttpServerPipelineFactory.getPipeline (HttpServerPipelineFactory.java:209) - Adding SSL handler
3807 2011-12-05 17:38:29,717 INFO [New I/O server boss #1 ([id: 0x2b2d96f2, /0:0:0:0:0:0:0:0:8989])] proxy.HttpRequestHandler.setupJmx (HttpRequestHandler.java:179) - Registering MBean with name: org.littleshoot.proxy:type=HttpRequestHandler-HttpRequestHandler-1108966327
3812 2011-12-05 17:38:29,722 INFO [New I/O server boss #1 ([id: 0x2b2d96f2, /0:0:0:0:0:0:0:0:8989])] proxy.HttpRequestHandler.channelOpen (HttpRequestHandler.java:547) - New channel opened: [id: 0x0ffdadcd, /127.0.0.1:35237 => /127.0.1.1:8989]
3812 2011-12-05 17:38:29,722 INFO [New I/O server boss #1 ([id: 0x2b2d96f2, /0:0:0:0:0:0:0:0:8989])] proxy.HttpRequestHandler.channelOpen (HttpRequestHandler.java:550) - Now 1 browser to proxy channels...
3812 2011-12-05 17:38:29,722 INFO [New I/O server boss #1 ([id: 0x2b2d96f2, /0:0:0:0:0:0:0:0:8989])] proxy.HttpRequestHandler.channelOpen (HttpRequestHandler.java:552) - Now this class has 1 browser to proxy channels...
3819 2011-12-05 17:38:29,729 INFO [New I/O server worker #1-1] proxy.HttpRequestHandler.exceptionCaught (HttpRequestHandler.java:664) - Caught an exception on browser to proxy channel: [id: 0x0ffdadcd, /127.0.0.1:35237 => /127.0.1.1:8989]
javax.net.ssl.SSLException: not an SSL/TLS record: 47455420687474703a2f2f7777772e61746c616e746963706163696669636d6f7274676167652e636f6d2f686f6d652e68746d20485454502f312e310d0a557365722d4167656e743a206375726c2f372e32312e3320287838365f36342d70632d6c696e75782d676e7529206c69626375726c2f372e32312e33204f70656e53534c2f302e392e386f207a6c69622f312e322e332e34206c696269646e2f312e31380d0a486f73743a207777772e61746c616e746963706163696669636d6f7274676167652e636f6d0d0a4163636570743a202a2f2a0d0a50726f78792d436f6e6e656374696f6e3a204b6565702d416c6976650d0a0d0a
at org.jboss.netty.handler.ssl.SslHandler.decode(SslHandler.java:591)
at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:282)
at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:216)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:351)
at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:282)
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:202)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
3822 2011-12-05 17:38:29,732 INFO [New I/O server worker #1-1] proxy.ProxyUtils.closeOnFlush (ProxyUtils.java:338) - Closing on flush: [id: 0x0ffdadcd, /127.0.0.1:35237 => /127.0.1.1:8989]
3827 2011-12-05 17:38:29,737 INFO [New I/O server worker #1-1] proxy.HttpRequestHandler.channelClosed (HttpRequestHandler.java:564) - Channel closed: [id: 0x0ffdadcd, /127.0.0.1:35237 :> /127.0.1.1:8989]
3828 2011-12-05 17:38:29,738 INFO [New I/O server worker #1-1] proxy.HttpRequestHandler.channelClosed (HttpRequestHandler.java:567) - Now 0 total browser to proxy channels...
3828 2011-12-05 17:38:29,738 INFO [New I/O server worker #1-1] proxy.HttpRequestHandler.channelClosed (HttpRequestHandler.java:569) - Now this class has 0 browser to proxy channels...
3828 2011-12-05 17:38:29,738 INFO [New I/O server worker #1-1] proxy.HttpRequestHandler.channelClosed (HttpRequestHandler.java:575) - Closing all proxy to web channels for this browser to proxy connection!!!