Codota Logo
jodd.http.net
Code IndexAdd Codota to your IDE (free)

How to use jodd.http.net

Best Java code snippets using jodd.http.net (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Dictionary d =
  • Codota Iconnew Hashtable()
  • Codota IconBundle bundle;bundle.getHeaders()
  • Codota Iconnew Properties()
  • Smart code suggestions by Codota
}
origin: oblac/jodd

@Override
public Socket createSocket(final String host, final int port) {
  return createSocks5ProxySocket(host, port);
}
origin: oblac/jodd

@Override
public Socket createSocket(final String host, final int port, final InetAddress localHost, final int localPort) {
  return createHttpProxySocket(host, port);
}
origin: oblac/jodd

@Override
public Socket createSocket(final String host, final int port, final InetAddress localHost, final int localPort) {
  return createSocks4ProxySocket(host, port);
}
origin: oblac/jodd

  SSLSocket sslSocket = createSSLSocket(
    httpRequest.host(),
    httpRequest.port(),
  );
  httpConnection = new SocketHttpSecureConnection(sslSocket);
  Socket socket = createSocket(httpRequest.host(), httpRequest.port(), httpRequest.connectionTimeout());
  httpConnection = new SocketHttpConnection(socket);
httpConnection.setTimeout(httpRequest.timeout());
  httpConnection.init();
  httpConnection.close();
origin: oblac/jodd

  /**
   * Returns socket factory based on proxy type and SSL requirements.
   */
  protected SocketFactory getSocketFactory(final ProxyInfo proxy, final boolean ssl, final boolean trustAllCertificates) throws IOException {
    switch (proxy.getProxyType()) {
      case NONE:
        if (ssl) {
          return getDefaultSSLSocketFactory(trustAllCertificates);
        }
        else {
          return SocketFactory.getDefault();
        }
      case HTTP:
        return new HTTPProxySocketFactory(proxy);
      case SOCKS4:
        return new Socks4ProxySocketFactory(proxy);
      case SOCKS5:
        return new Socks5ProxySocketFactory(proxy);
      default:
        return null;
    }
  }
}
origin: oblac/jodd

@Test
@Disabled
void testHttpProxy() {
  SocketHttpConnectionProvider s = new SocketHttpConnectionProvider();
  s.useProxy(ProxyInfo.httpProxy("localhost", 1090, null, null));
  HttpResponse response = HttpRequest.get("http://localhost:1080/get_books")
    .withConnectionProvider(s)
    .send();
  assertEquals(200, response.statusCode());
  assertTrue(response.body().contains("Tatum"));
}
origin: oblac/jodd

final boolean trustAll, final boolean verifyHttpsHost) throws IOException {
SocketFactory socketFactory = getSocketFactory(proxy, true, trustAll);
    sslSocket = (SSLSocket) (getDefaultSSLSocketFactory(trustAll)).createSocket(socket, host, port, true);
origin: oblac/jodd

  @Override
  public void init() throws IOException {
    super.init();

    sslSocket.startHandshake();
  }
}
origin: oblac/jodd

/**
 * Creates a socket using socket factory.
 */
protected Socket createSocket(final String host, final int port, final int connectionTimeout) throws IOException {
  SocketFactory socketFactory = getSocketFactory(proxy, false, false);
  if (connectionTimeout < 0) {
    return socketFactory.createSocket(host, port);
  }
  else {
    // creates unconnected socket
    Socket socket = socketFactory.createSocket();
    socket.connect(new InetSocketAddress(host, port), connectionTimeout);
    return socket;
  }
}
origin: oblac/jodd

@Test
void testSocks5Proxy() {
  SocketHttpConnectionProvider s = new SocketHttpConnectionProvider();
  s.useProxy(ProxyInfo.socks5Proxy("localhost", 1090, null, null));
  HttpResponse response = HttpRequest.get("http://localhost:1080/get_books")
    .withConnectionProvider(s)
    .send();
  assertEquals(200, response.statusCode());
  assertTrue(response.body().contains("Tatum"));
  proxy.verify(request().withPath("/get_books"), exactly(1));
}
origin: oblac/jodd

@Override
public Socket createSocket(final String host, final int port, final InetAddress localHost, final int localPort) {
  return createSocks5ProxySocket(host, port);
}
origin: oblac/jodd

@Override
public Socket createSocket(final String host, final int port) {
  return createHttpProxySocket(host, port);
}
origin: oblac/jodd

@Override
public Socket createSocket(final String host, final int port) {
  return createSocks4ProxySocket(host, port);
}
origin: oblac/jodd

@Test
void testSocks5ProxyWithHttps() {
  SocketHttpConnectionProvider s = new SocketHttpConnectionProvider();
  s.useProxy(ProxyInfo.socks5Proxy("localhost", 1090, null, null));
  HttpResponse response = HttpRequest.get("https://localhost:1080/get_books")
    .withConnectionProvider(s)
    .trustAllCerts(true)
    .send();
  assertEquals(200, response.statusCode());
  assertTrue(response.body().contains("Tatum"));
  proxy.verify(request().withPath("/get_books"), exactly(1));
}
origin: oblac/jodd

@Override
public Socket createSocket(final InetAddress host, final int port) {
  return createSocks5ProxySocket(host.getHostAddress(), port);
}
origin: oblac/jodd

@Override
public Socket createSocket(final InetAddress host, final int port) {
  return createHttpProxySocket(host.getHostAddress(), port);
}
origin: oblac/jodd

@Override
public Socket createSocket(final InetAddress host, final int port) {
  return createSocks4ProxySocket(host.getHostAddress(), port);
}
origin: oblac/jodd

@Override
public Socket createSocket(final InetAddress address, final int port, final InetAddress localAddress, final int localPort) {
  return createSocks5ProxySocket(address.getHostAddress(), port);
}
origin: oblac/jodd

@Override
public Socket createSocket(final InetAddress address, final int port, final InetAddress localAddress, final int localPort) {
  return createHttpProxySocket(address.getHostAddress(), port);
}
origin: oblac/jodd

@Override
public Socket createSocket(final InetAddress address, final int port, final InetAddress localAddress, final int localPort) {
  return createSocks4ProxySocket(address.getHostAddress(), port);
}
jodd.http.net

Most used classes

  • SocketHttpConnectionProvider
    Socket factory for HTTP proxy.
  • HTTPProxySocketFactory
    Socket factory for HTTP proxy.
  • SocketHttpConnection
    Socket-based jodd.http.HttpConnection.
  • SocketHttpSecureConnection
  • Socks4ProxySocketFactory
    Socket factory for SOCKS4 proxy. This proxy does not do password authentication. See: http://www.ope
  • SSLSocketHttpConnectionProvider
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now