Question

I have started a spdy proxy server using jetty9.

jetty-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

This server has started normally.

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}

In my mind, this proxy server can translate spdy to http and proxy it to the target server.

I cannot test it now because I donnot know how to talk to the proxy server with java client(not in browser). I have googled my problem but found nothing, any suggestion here?

Was it helpful?

Solution

Working with raw SPDY is unlike anything you've likely done before.

But that being said, there are unit tests in Jetty 9 that use Jetty's SPDYClient to test its own support of SPDY. They might help you.

http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToHTTPTest.java

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top