Skip to content

Commit

Permalink
ensure fillCommand method
Browse files Browse the repository at this point in the history
Signed-off-by: BrouseLi <[email protected]>
  • Loading branch information
BrouseLi committed Mar 31, 2020
1 parent c8cde54 commit 91db9b7
Show file tree
Hide file tree
Showing 34 changed files with 698 additions and 1,069 deletions.
666 changes: 317 additions & 349 deletions .idea/workspace.xml

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions mimicwebpolicy.iml
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,9 @@
<orderEntry type="library" name="Maven: org.junit.jupiter:junit-jupiter-api:5.1.1" level="project" />
<orderEntry type="library" name="Maven: org.opentest4j:opentest4j:1.0.0" level="project" />
<orderEntry type="library" name="Maven: org.junit.platform:junit-platform-commons:1.1.1" level="project" />
<orderEntry type="library" name="Maven: com.squareup.okhttp3:okhttp:4.2.2" level="project" />
<orderEntry type="library" name="Maven: com.squareup.okio:okio:2.2.2" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib:1.2.41" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains:annotations:13.0" level="project" />
</component>
</module>
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@
<artifactId>junit-jupiter-params</artifactId>
<version>5.5.2</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.2.2</version>
</dependency>
</dependencies>

<build>
Expand Down
66 changes: 66 additions & 0 deletions src/main/java/com/angshi/mimicwebpolicy/Config/OkHttpConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package com.angshi.mimicwebpolicy.Config;

import okhttp3.ConnectionPool;
import okhttp3.OkHttpClient;
import org.springframework.context.annotation.Bean;

import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.concurrent.TimeUnit;

public class OkHttpConfig {
@Bean
public X509TrustManager x509TrustManager() {
return new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
}
@Override
public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
};
}
@Bean
public SSLSocketFactory sslSocketFactory() {
try {
//信任任何链接
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(null, new TrustManager[]{x509TrustManager()}, new SecureRandom());
return sslContext.getSocketFactory();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (KeyManagementException e) {
e.printStackTrace();
}
return null;
}
/**
* Create a new connection pool with tuning parameters appropriate for a single-user application.
* The tuning parameters in this pool are subject to change in future OkHttp releases. Currently
*/
@Bean
public ConnectionPool pool() {
return new ConnectionPool(200, 5, TimeUnit.MINUTES);
}
@Bean
public OkHttpClient okHttpClient() {
return new OkHttpClient.Builder()
.sslSocketFactory(sslSocketFactory(), x509TrustManager())
.retryOnConnectionFailure(false)//是否开启缓存
.connectionPool(pool())//连接池
.connectTimeout(10L, TimeUnit.SECONDS)
.readTimeout(10L, TimeUnit.SECONDS)
.build();
}
}
104 changes: 0 additions & 104 deletions src/main/java/com/angshi/mimicwebpolicy/Entity/Board.java

This file was deleted.

29 changes: 0 additions & 29 deletions src/main/java/com/angshi/mimicwebpolicy/Entity/Boards.java

This file was deleted.

21 changes: 0 additions & 21 deletions src/main/java/com/angshi/mimicwebpolicy/Entity/Hardware.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package com.angshi.mimicwebpolicy.Entity;


/*import com.WSSmCommUpperServiceImplServiceLocator;
import com.WSSmCommUpperServiceImplServiceSoapBindingStub;*/

public class HelloWorldClient {
public static void main(String[] argv) {
//try {
Expand Down
117 changes: 0 additions & 117 deletions src/main/java/com/angshi/mimicwebpolicy/Entity/Interface.java

This file was deleted.

This file was deleted.

Loading

0 comments on commit 91db9b7

Please sign in to comment.