use of okhttp3.CertificatePinner.Pin in project okhttp by square.
the class CertificatePinnerTest method successfulFindMatchingPinsIgnoresCase.
@Test
public void successfulFindMatchingPinsIgnoresCase() {
CertificatePinner certificatePinner = new CertificatePinner.Builder().add("EXAMPLE.com", certA1Sha256Pin).add("*.MyExample.Com", certB1Sha256Pin).build();
List<Pin> expectedPin1 = Arrays.asList(new Pin("EXAMPLE.com", certA1Sha256Pin));
assertEquals(expectedPin1, certificatePinner.findMatchingPins("example.com"));
List<Pin> expectedPin2 = Arrays.asList(new Pin("*.MyExample.Com", certB1Sha256Pin));
assertEquals(expectedPin2, certificatePinner.findMatchingPins("a.myexample.com"));
}
use of okhttp3.CertificatePinner.Pin in project okhttp by square.
the class CertificatePinnerTest method successfulFindMatchingPinsForWildcardAndDirectCertificates.
@Test
public void successfulFindMatchingPinsForWildcardAndDirectCertificates() {
CertificatePinner certificatePinner = new CertificatePinner.Builder().add("*.example.com", certA1Sha256Pin).add("a.example.com", certB1Sha256Pin).add("b.example.com", certC1Sha256Pin).build();
List<Pin> expectedPins = Arrays.asList(new Pin("*.example.com", certA1Sha256Pin), new Pin("a.example.com", certB1Sha256Pin));
assertEquals(expectedPins, certificatePinner.findMatchingPins("a.example.com"));
}
use of okhttp3.CertificatePinner.Pin in project okhttp by square.
the class CertificatePinnerTest method successfulFindMatchingPins.
@Test
public void successfulFindMatchingPins() {
CertificatePinner certificatePinner = new CertificatePinner.Builder().add("first.com", certA1Sha256Pin, certB1Sha256Pin).add("second.com", certC1Sha256Pin).build();
List<Pin> expectedPins = Arrays.asList(new Pin("first.com", certA1Sha256Pin), new Pin("first.com", certB1Sha256Pin));
assertEquals(expectedPins, certificatePinner.findMatchingPins("first.com"));
}
use of okhttp3.CertificatePinner.Pin in project okhttp by square.
the class CertificatePinnerTest method successfulFindMatchingPinPunycode.
@Test
public void successfulFindMatchingPinPunycode() {
CertificatePinner certificatePinner = new CertificatePinner.Builder().add("σkhttp.com", certA1Sha256Pin).build();
List<Pin> expectedPin = Arrays.asList(new Pin("σkhttp.com", certA1Sha256Pin));
assertEquals(expectedPin, certificatePinner.findMatchingPins("xn--khttp-fde.com"));
}
use of okhttp3.CertificatePinner.Pin in project retrofit by square.
the class RequestBuilderTest method formEncodedWithEncodedNameFieldParamMap.
@Test
public void formEncodedWithEncodedNameFieldParamMap() {
class Example {
//
@FormUrlEncoded
//
@POST("/foo")
Call<ResponseBody> method(@FieldMap(encoded = true) Map<String, Object> fieldMap) {
return null;
}
}
Map<String, Object> fieldMap = new LinkedHashMap<>();
fieldMap.put("k%20it", "k%20at");
fieldMap.put("pin%20g", "po%20ng");
Request request = buildRequest(Example.class, fieldMap);
assertBody(request.body(), "k%20it=k%20at&pin%20g=po%20ng");
}
Aggregations