@Test public void httpProxy_nullNegotiatorNpe() throws Exception { thrown.expect(NullPointerException.class); Object unused = ProtocolNegotiators.httpProxy( InetSocketAddress.createUnresolved("localhost", 80), "user", "pass", null); }
public static ProtocolNegotiator httpProxy(final SocketAddress proxyAddress, final @Nullable String proxyUsername, final @Nullable String proxyPassword, final ProtocolNegotiator negotiator) { Preconditions.checkNotNull(proxyAddress, "proxyAddress"); Preconditions.checkNotNull(negotiator, "negotiator"); class ProxyNegotiator implements ProtocolNegotiator { @Override public Handler newHandler(GrpcHttp2ConnectionHandler http2Handler) { HttpProxyHandler proxyHandler; if (proxyUsername == null || proxyPassword == null) { proxyHandler = new HttpProxyHandler(proxyAddress); } else { proxyHandler = new HttpProxyHandler(proxyAddress, proxyUsername, proxyPassword); } return new BufferUntilProxyTunnelledHandler( proxyHandler, negotiator.newHandler(http2Handler)); } @Override public void close() { negotiator.close(); } } return new ProxyNegotiator(); }
ProtocolNegotiators { public static ProtocolNegotiator httpProxy(final SocketAddress proxyAddress, final @Nullable String proxyUsername, final @Nullable String proxyPassword, final ProtocolNegotiator negotiator) { Preconditions.checkNotNull(proxyAddress, "proxyAddress"); Preconditions.checkNotNull(negotiator, "negotiator"); class ProxyNegotiator implements ProtocolNegotiator { @Override public Handler newHandler(GrpcHttp2ConnectionHandler http2Handler) { HttpProxyHandler proxyHandler; if (proxyUsername == null || proxyPassword == null) { proxyHandler = new HttpProxyHandler(proxyAddress); } else { proxyHandler = new HttpProxyHandler(proxyAddress, proxyUsername, proxyPassword); } return new BufferUntilProxyTunnelledHandler( proxyHandler, negotiator.newHandler(http2Handler)); } @Override public void close() { negotiator.close(); } } return new ProxyNegotiator(); } }
ProtocolNegotiators { public static ProtocolNegotiator httpProxy(final SocketAddress proxyAddress, final @Nullable String proxyUsername, final @Nullable String proxyPassword, final ProtocolNegotiator negotiator) { Preconditions.checkNotNull(proxyAddress, "proxyAddress"); Preconditions.checkNotNull(negotiator, "negotiator"); class ProxyNegotiator implements ProtocolNegotiator { @Override public Handler newHandler(GrpcHttp2ConnectionHandler http2Handler) { HttpProxyHandler proxyHandler; if (proxyUsername == null || proxyPassword == null) { proxyHandler = new HttpProxyHandler(proxyAddress); } else { proxyHandler = new HttpProxyHandler(proxyAddress, proxyUsername, proxyPassword); } return new BufferUntilProxyTunnelledHandler( proxyHandler, negotiator.newHandler(http2Handler)); } @Override public void close() { negotiator.close(); } } return new ProxyNegotiator(); } private  ProtocolNegotiators(); }
ProtocolNegotiators { public static ProtocolNegotiator httpProxy(final SocketAddress proxyAddress, final @Nullable String proxyUsername, final @Nullable String proxyPassword, final ProtocolNegotiator negotiator) { Preconditions.checkNotNull(proxyAddress, "proxyAddress"); Preconditions.checkNotNull(negotiator, "negotiator"); class ProxyNegotiator implements ProtocolNegotiator { @Override public Handler newHandler(GrpcHttp2ConnectionHandler http2Handler) { HttpProxyHandler proxyHandler; if (proxyUsername == null || proxyPassword == null) { proxyHandler = new HttpProxyHandler(proxyAddress); } else { proxyHandler = new HttpProxyHandler(proxyAddress, proxyUsername, proxyPassword); } return new BufferUntilProxyTunnelledHandler( proxyHandler, negotiator.newHandler(http2Handler)); } @Override public void close() { negotiator.close(); } } return new ProxyNegotiator(); } private  ProtocolNegotiators(); static ProtocolNegotiator serverPlaintext(); static ProtocolNegotiator serverTls(final SslContext sslContext); static ProtocolNegotiator httpProxy(final SocketAddress proxyAddress,
      final @Nullable String proxyUsername, final @Nullable String proxyPassword,
      final ProtocolNegotiator negotiator); static ProtocolNegotiator tls(SslContext sslContext); static ProtocolNegotiator plaintextUpgrade(); static ProtocolNegotiator plaintext(); }
ProtocolNegotiators { public static ProtocolNegotiator httpProxy(final SocketAddress proxyAddress, final @Nullable String proxyUsername, final @Nullable String proxyPassword, final ProtocolNegotiator negotiator) { Preconditions.checkNotNull(proxyAddress, "proxyAddress"); Preconditions.checkNotNull(negotiator, "negotiator"); class ProxyNegotiator implements ProtocolNegotiator { @Override public Handler newHandler(GrpcHttp2ConnectionHandler http2Handler) { HttpProxyHandler proxyHandler; if (proxyUsername == null || proxyPassword == null) { proxyHandler = new HttpProxyHandler(proxyAddress); } else { proxyHandler = new HttpProxyHandler(proxyAddress, proxyUsername, proxyPassword); } return new BufferUntilProxyTunnelledHandler( proxyHandler, negotiator.newHandler(http2Handler)); } @Override public void close() { negotiator.close(); } } return new ProxyNegotiator(); } private  ProtocolNegotiators(); static ProtocolNegotiator serverPlaintext(); static ProtocolNegotiator serverTls(final SslContext sslContext); static ProtocolNegotiator httpProxy(final SocketAddress proxyAddress,
      final @Nullable String proxyUsername, final @Nullable String proxyPassword,
      final ProtocolNegotiator negotiator); static ProtocolNegotiator tls(SslContext sslContext); static ProtocolNegotiator plaintextUpgrade(); static ProtocolNegotiator plaintext();  }