我已经使用 jetty9 启动了一个 spdy 代理服务器。
码头-spdy-proxy.xml:
<New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
<Set name="KeyStorePath"><Property name="jetty.home" default="." />/etc/keystore</Set>
<Set name="KeyStorePassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
<Set name="KeyManagerPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
<Set name="TrustStorePath"><Property name="jetty.home" default="." />/etc/keystore</Set>
<Set name="TrustStorePassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
</New>
<New id="tlsHttpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
<Arg><Ref refid="httpConfig"/></Arg>
<Call name="addCustomizer">
<Arg><New class="org.eclipse.jetty.server.SecureRequestCustomizer"/></Arg>
</Call>
</New>
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ServerConnector">
<Arg name="server"><Ref id="Server" /></Arg>
<Arg name="factories">
<Array type="org.eclipse.jetty.server.ConnectionFactory">
<Item>
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
<Arg name="config"><Ref id="httpConfig" /></Arg>
</New>
</Item>
</Array>
</Arg>
<Set name="host"><Property name="jetty.host" /></Set>
<Set name="port"><Property name="jetty.port" default="9090" /></Set>
<Set name="idleTimeout">30000</Set>
</New>
</Arg>
</Call>
http/1.1 本地主机 http/1.1 127.0.0.1 9090
8080 8443
此服务器已正常启动。
2013-03-28 17:49:02.623:INFO:oejsh.ContextHandler:main: started o.e.j.w.WebAppContext@4a734beb{/test,file:/tmp/jetty-0.0.0.0-8443-test.war-_test-any-/webapp/,AVAILABLE}{/test.war}
2013-03-28 17:49:02.911:WARN::main: async-rest webapp is deployed. DO NOT USE IN PRODUCTION!
2013-03-28 17:49:02.990:INFO:oejsh.ContextHandler:main: started o.e.j.w.WebAppContext@28245558{/async-rest,[file:/tmp/jetty-0.0.0.0-8443-async-rest.war-_async-rest-any-/webapp/, jar:file:/tmp/jetty-0.0.0.0-8443-async-rest.war-_async-rest-any-/webapp/WEB-INF/lib/example-async-rest-jar-9.0.0.v20130308.jar!/META-INF/resources/],AVAILABLE}{/async-rest.war}
2013-03-28 17:49:03.061:INFO:oejsh.ContextHandler:main: started o.e.j.s.h.MovedContextHandler@b102b93{/oldContextPath,null,AVAILABLE}
2013-03-28 17:49:03.159:INFO:oejsh.ContextHandler:main: started o.e.j.s.h.ContextHandler@36858c07{/javadoc,file:/home/sankuai/jetty/jetty9/javadoc,AVAILABLE}
2013-03-28 17:49:03.669:INFO:oejsh.ContextHandler:main: started o.e.j.w.WebAppContext@646dee9f{/proxy,file:/tmp/jetty-0.0.0.0-8443-xref-proxy.war-_xref-proxy-any-/webapp/,AVAILABLE}{/xref-proxy.war}
2013-03-28 17:49:03.913:INFO:oejs.ServerConnector:main: Started ServerConnector@4456cd93{SSL-npn}{0.0.0.0:8443}
在我看来,这个代理服务器可以将 spdy 转换为 http 并将其代理到目标服务器。
我现在无法测试它,因为我不知道如何使用 java 客户端(不在浏览器中)与代理服务器通信。我用谷歌搜索了我的问题,但什么也没找到,这里有什么建议吗?