use of org.openecard.bouncycastle.tls.DefaultTlsClient in project open-ecard by ecsec.
the class StreamHttpClientConnectionTest method testRequestHttpsGoogle.
@Test
public void testRequestHttpsGoogle() throws IOException, HttpException {
final String hostName = "www.google.com";
// open connection
Socket socket = new Socket(hostName, 443);
assertTrue(socket.isConnected());
DefaultTlsClient tlsClient = new DefaultTlsClientImpl(new BcTlsCrypto(rand)) {
@Override
protected Vector getSNIServerNames() {
return new Vector(Collections.singletonList(hostName));
}
};
TlsClientProtocol handler = new TlsClientProtocol(socket.getInputStream(), socket.getOutputStream());
handler.connect(tlsClient);
StreamHttpClientConnection conn = new StreamHttpClientConnection(handler.getInputStream(), handler.getOutputStream());
assertTrue(conn.isOpen());
consumeEntity(conn, hostName, 2);
}
Aggregations