簡體   English   中英

用java客戶端與spdy服務器通信

[英]Talking to the spdy server with java client

我已經使用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 localhost 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客戶端(而不是在瀏覽器中)與代理服務器通信。 我搜索了我的問題但沒有發現任何問題,這里有任何建議嗎?

使用原始SPDY不同於您以前可能做過的任何事情。

但話雖如此,Jetty 9中的單元測試使用Jetty的SPDYClient來測試它自己對SPDY的支持。 他們可能會幫助你。

http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/服務器/代理/ ProxySPDYToHTTPTest.java

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM