2013-03-28 84 views
1

我开始使用jetty9的spdy代理服务器。用java客户端与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

这台服务器已经正常启动。

2013-03-28 17:49:02.623:INFO:oejsh.ContextHandler:main: started [email protected]{/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 [email protected]{/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 [email protected]{/oldContextPath,null,AVAILABLE} 
2013-03-28 17:49:03.159:INFO:oejsh.ContextHandler:main: started [email protected]{/javadoc,file:/home/sankuai/jetty/jetty9/javadoc,AVAILABLE} 
2013-03-28 17:49:03.669:INFO:oejsh.ContextHandler:main: started [email protected]{/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 [email protected]{SSL-npn}{0.0.0.0:8443} 

在我看来,这个代理服务器可以将spdy转换为http并将其代理到目标服务器。

我现在无法测试它,因为我不知道如何用java客户端(不在浏览器中)与代理服务器通信。我搜索了我的问题,但什么也没找到,这里有什么建议?

回答