List of usage examples for com.squareup.okhttp ConnectionPool getSpdyConnectionCount
@Deprecated public synchronized int getSpdyConnectionCount()
From source file:twitter4j.SpdyHttpClientTest.java
License:Apache License
public void testNoPreferOption() throws Exception { AlternativeHttpClientImpl http = callOembed(); // check HTTP/2.0 Field f = http.getClass().getDeclaredField("client"); f.setAccessible(true);// w ww . j av a 2 s . co m OkHttpClient client = (OkHttpClient) f.get(http); assertNotNull("ensure that OkHttpClient is used", client); ConnectionPool p = client.getConnectionPool(); assertEquals(1, p.getConnectionCount()); assertEquals(0, p.getHttpConnectionCount()); assertEquals(1, p.getSpdyConnectionCount()); assertEquals("HTTP-draft-09/2.0", http.getLastRequestProtocol()); }
From source file:twitter4j.SpdyHttpClientTest.java
License:Apache License
public void testSpdy() throws Exception { AlternativeHttpClientImpl.sPreferSpdy = true; AlternativeHttpClientImpl.sPreferHttp2 = false; AlternativeHttpClientImpl http = callOembed(); // check SPDY Field f = http.getClass().getDeclaredField("client"); f.setAccessible(true);//w ww . j a va 2s.c o m OkHttpClient client = (OkHttpClient) f.get(http); assertNotNull("ensure that OkHttpClient is used", client); ConnectionPool p = client.getConnectionPool(); assertEquals(1, p.getConnectionCount()); assertEquals(0, p.getHttpConnectionCount()); assertEquals(1, p.getSpdyConnectionCount()); assertEquals("spdy/3.1", http.getLastRequestProtocol()); }
From source file:twitter4j.SpdyHttpClientTest.java
License:Apache License
public void testHttp2() throws Exception { AlternativeHttpClientImpl.sPreferSpdy = false; AlternativeHttpClientImpl.sPreferHttp2 = true; AlternativeHttpClientImpl http = callOembed(); // check HTTP/2.0 Field f = http.getClass().getDeclaredField("client"); f.setAccessible(true);/*www. j av a 2s .c om*/ OkHttpClient client = (OkHttpClient) f.get(http); assertNotNull("ensure that OkHttpClient is used", client); ConnectionPool p = client.getConnectionPool(); assertEquals(1, p.getConnectionCount()); assertEquals(0, p.getHttpConnectionCount()); assertEquals(1, p.getSpdyConnectionCount()); assertEquals("HTTP-draft-09/2.0", http.getLastRequestProtocol()); }